query_name
stringlengths
13
55
code_file_path
stringlengths
14
194
context_blocks
list
answer_spans
list
supporting_fact_spans
list
example_type
int8
0
1
single_hop
bool
2 classes
subtokenized_input_sequence
list
label_sequence
list
Unused import
ofri/Open-Knesset/mks/tests.py
[ { "content": "import re\n\nfrom django.test import TestCase\nfrom django.test.client import Client\nfrom django.core.urlresolvers import reverse\nfrom django.contrib.auth.models import User, AnonymousUser\nfrom django.contrib.sites.models import Site\nfrom tastypie.test import ResourceTestCase\nfrom actstream import follow,action\nfrom actstream.models import Action\nfrom mks.models import Member, Party, Membership, MemberAltname, Knesset\nfrom mks.views import MemberListView\nfrom laws.models import Law,Bill,PrivateProposal,Vote,VoteAction\nfrom committees.models import CommitteeMeeting,Committee\nfrom knesset.utils import RequestFactory\nimport datetime\nimport feedparser\nimport json\nfrom backlinks.tests.xmlrpc import TestClientServerProxy\nfrom xmlrpclib import Fault, loads\nfrom urllib import urlencode\nfrom backlinks.models import InboundBacklink\nfrom backlinks.pingback.server import PingbackServer\nfrom django import template\nfrom mks.mock import PINGABLE_MEMBER_ID, NON_PINGABLE_MEMBER_ID\nfrom persons.models import Person, PersonAlias\n\nTRACKBACK_CONTENT_TYPE = 'application/x-www-form-urlencoded; charset=utf-8'\n\njust_id = lambda x: x.id\n\n\n\n\n\nfrom agendas.models import Agenda, AgendaVote\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class MemberViewsTest(TestCase):\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.MemberViewsTest", "header": "['module', '___EOS___']", "index": 31 }, { "content": " def setUp(self):\n # make sure cache is clean, to prevent some failing tests with\n # unexpected caches\n from django.core.cache import cache\n\n cache.clear()\n\n d = datetime.date.today()\n\n self.knesset = Knesset.objects.create(\n number=1,\n start_date=d-datetime.timedelta(10))\n self.party_1 = Party.objects.create(name='party 1',\n knesset=self.knesset)\n self.party_2 = Party.objects.create(name='party 2',\n knesset=self.knesset)\n self.mk_1 = Member.objects.create(name='mk_1',\n start_date=datetime.date(2010,1,1),\n current_party=self.party_1,\n backlinks_enabled=True)\n self.mk_2 = Member.objects.create(name='mk_2',\n start_date=datetime.date(2010,1,1),\n current_party=self.party_1,\n backlinks_enabled = False)\n self.jacob = User.objects.create_user('jacob', '[email protected]',\n 'JKM')\n\n self.committee_1 = Committee.objects.create(name='c1')\n self.meeting_1 = self.committee_1.meetings.create(\n date=d-datetime.timedelta(1),\n protocol_text='jacob:\\nI am a perfectionist\\nadrian:\\nI have a deadline')\n self.meeting_2 = self.committee_1.meetings.create(\n date=d-datetime.timedelta(2),\n protocol_text='adrian:\\nYou are a perfectionist\\njacob:\\nYou have a deadline')\n self.law = Law.objects.create(title='law 1')\n self.pp = PrivateProposal.objects.create(title='private proposal 1', date=datetime.date.today()-datetime.timedelta(3))\n self.pp.proposers.add(self.mk_1)\n self.bill_1 = Bill.objects.create(stage='1', title='bill 1', law=self.law)\n self.bill_1.proposals.add(self.pp)\n self.bill_1.proposers.add(self.mk_1)\n self.meeting_1.mks_attended.add(self.mk_1)\n self.meeting_1.save()\n self.meeting_2.mks_attended.add(self.mk_1)\n self.meeting_2.save()\n self.vote = Vote.objects.create(title='vote 1',time=datetime.datetime.now())\n self.vote_action = VoteAction.objects.create(member=self.mk_1, vote=self.vote, type='for', party=self.mk_1.current_party)\n self.domain = 'http://' + Site.objects.get_current().domain", "metadata": "root.MemberViewsTest.setUp", "header": "['class', 'MemberViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 33 }, { "content": " def testMemberList(self):\n res = self.client.get(reverse('member-list'))\n self.assertEqual(res.status_code, 301)\n\n res = self.client.get(reverse('member-stats', kwargs={'stat_type': 'bills_pre'}))\n self.assertEqual(res.status_code, 200)\n self.assertTemplateUsed(res, 'mks/member_list.html')\n object_list = res.context['object_list']\n self.assertItemsEqual(map(just_id, object_list), [self.mk_1.id, self.mk_2.id])", "metadata": "root.MemberViewsTest.testMemberList", "header": "['class', 'MemberViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 81 }, { "content": " def testMemberDetail(self):\n res = self.client.get(reverse('member-detail', args=[self.mk_1.id]))\n self.assertTemplateUsed(res,\n 'mks/member_detail.html')\n self.assertEqual(res.context['object'].id, self.mk_1.id)", "metadata": "root.MemberViewsTest.testMemberDetail", "header": "['class', 'MemberViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 91 }, { "content": " def testMemberDetailOtherVerbs(self):\n \"\"\"Tests the member detail view with parameters that make it render\n actions other than the default ones\"\"\"\n res = self.client.get('%s?verbs=attended&verbs=voted' %\n reverse('member-detail', args=[self.mk_1.id]))\n self.assertTemplateUsed(res,\n 'mks/member_detail.html')\n self.assertEqual(res.context['object'].id, self.mk_1.id)", "metadata": "root.MemberViewsTest.testMemberDetailOtherVerbs", "header": "['class', 'MemberViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 97 }, { "content": " def testPartyList(self):\n # party list should redirect to stats by seat\n res = self.client.get(reverse('party-list'))\n self.assertRedirects(res, reverse('party-stats', kwargs={'stat_type': 'seats'}), 301)\n\n #self.assertTemplateUsed(res, 'mks/party_list.html')\n #object_list = res.context['object_list']\n #self.assertEqual(map(just_id, object_list),\n # [ self.party_1.id, self.party_2.id, ])", "metadata": "root.MemberViewsTest.testPartyList", "header": "['class', 'MemberViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 106 }, { "content": " def testPartyDetail(self):\n res = self.client.get(reverse('party-detail',\n args=[self.party_1.id]))\n self.assertTemplateUsed(res, 'mks/party_detail.html')\n self.assertEqual(res.context['object'].id, self.party_1.id)", "metadata": "root.MemberViewsTest.testPartyDetail", "header": "['class', 'MemberViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 116 }, { "content": " def testMemberDetailsContext(self):\n\n # test anonymous user\n mk_1_url = self.mk_1.get_absolute_url()\n res = self.client.get(mk_1_url)\n self.assertFalse(res.context['watched_member'])\n # test autherized user\n self.assertTrue(self.client.login(username='jacob', password='JKM'))\n res = self.client.get(mk_1_url)\n self.assertFalse(res.context['watched_member'])\n # test autherized user that follows\n follow(self.jacob, self.mk_1)\n res = self.client.get(mk_1_url)\n self.assertTrue(res.context['watched_member'])", "metadata": "root.MemberViewsTest.testMemberDetailsContext", "header": "['class', 'MemberViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 122 }, { "content": " def testMemberActivityFeed(self):\n res = self.client.get(reverse('member-activity-feed',\n args=[self.mk_1.id]))\n self.assertEqual(res.status_code,200)\n parsed = feedparser.parse(res.content)\n # self.assertEqual(len(parsed['entries']),4)\n self.assertEqual(parsed['entries'][0]['link'], self.domain +\n self.vote.get_absolute_url())\n self.assertEqual(parsed['entries'][1]['link'], self.domain +\n self.meeting_1.get_absolute_url())\n self.assertEqual(parsed['entries'][2]['link'], self.domain +\n self.meeting_2.get_absolute_url())\n self.assertEqual(parsed['entries'][3]['link'], self.domain +\n self.bill_1.get_absolute_url())", "metadata": "root.MemberViewsTest.testMemberActivityFeed", "header": "['class', 'MemberViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 137 }, { "content": " def testMemberActivityFeedWithVerbProposed(self):\n res = self.client.get(reverse('member-activity-feed',\n kwargs={'object_id': self.mk_1.id}),{'verbs':'proposed'})\n self.assertEqual(res.status_code,200)\n parsed = feedparser.parse(res.content)\n self.assertEqual(len(parsed['entries']),1)\n\n res = self.client.get(reverse('member-activity-feed',\n kwargs={'object_id': self.mk_2.id}),{'verbs':'proposed'})\n self.assertEqual(res.status_code,200)\n parsed = feedparser.parse(res.content)\n self.assertEqual(len(parsed['entries']),0)", "metadata": "root.MemberViewsTest.testMemberActivityFeedWithVerbProposed", "header": "['class', 'MemberViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 152 }, { "content": " def testMemberActivityFeedWithVerbAttended(self):\n res = self.client.get(reverse('member-activity-feed',\n kwargs={'object_id': self.mk_1.id}),{'verbs':'attended'})\n self.assertEqual(res.status_code,200)\n parsed = feedparser.parse(res.content)\n self.assertEqual(len(parsed['entries']),2)\n\n res = self.client.get(reverse('member-activity-feed',\n kwargs={'object_id': self.mk_2.id}),{'verbs':'attended'})\n self.assertEqual(res.status_code,200)\n parsed = feedparser.parse(res.content)\n self.assertEqual(len(parsed['entries']),0)", "metadata": "root.MemberViewsTest.testMemberActivityFeedWithVerbAttended", "header": "['class', 'MemberViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 165 }, { "content": " def testMemberActivityFeedWithVerbJoined(self):\n res = self.client.get(reverse('member-activity-feed',\n kwargs={'object_id': self.mk_1.id}),{'verbs':'joined'})\n self.assertEqual(res.status_code,200)\n parsed = feedparser.parse(res.content)\n self.assertEqual(len(parsed['entries']),0)", "metadata": "root.MemberViewsTest.testMemberActivityFeedWithVerbJoined", "header": "['class', 'MemberViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 178 }, { "content": " def testMemberActivityFeedWithVerbPosted(self):\n res = self.client.get(reverse('member-activity-feed',\n kwargs={'object_id': self.mk_1.id}),{'verbs':'posted'})\n self.assertEqual(res.status_code,200)\n parsed = feedparser.parse(res.content)\n self.assertEqual(len(parsed['entries']),0)", "metadata": "root.MemberViewsTest.testMemberActivityFeedWithVerbPosted", "header": "['class', 'MemberViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 186 }, { "content": " def tearDown(self):\n self.party_1.delete()\n self.party_2.delete()\n self.mk_1.delete()\n self.mk_2.delete()\n self.jacob.delete()", "metadata": "root.MemberViewsTest.tearDown", "header": "['class', 'MemberViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 193 }, { "content": "class MemberBacklinksViewsTest(TestCase):\n urls = 'mks.server_urls'\n\n\n\n\n '''\n def testTrackBackRDFTemplateTag(self):\n t = template.Template(\"{% load trackback_tags %}{% trackback_rdf object_url object_title trackback_url True %}\")\n c = template.Context({'trackback_url': '/trackback/member/'+self.PINGABLE_MEMBER_ID+'/',\n 'object_url': self.pingableTargetUrl,\n 'object_title': 'Pingable Test Entry'})\n rendered = t.render(c)\n link_re = re.compile(r'dc:identifier=\"(?P<link>[^\"]+)\"')\n match = link_re.search(rendered)\n self.assertTrue(bool(match), 'TrackBack RDF not rendered')\n self.assertEquals(match.groups('link')[0], self.pingableTargetUrl,\n 'TrackBack RDF did not contain a valid target URI')\n ping_re = re.compile(r'trackback:ping=\"(?P<link>[^\"]+)\"')\n match = ping_re.search(rendered)\n self.assertTrue(bool(match), 'TrackBack RDF not rendered')\n self.assertEquals(match.groups('link')[0], '/trackback/member/'+self.PINGABLE_MEMBER_ID+'/',\n 'TrackBack RDF did not contain a TrackBack server URI')\n\n '''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.MemberBacklinksViewsTest", "header": "['module', '___EOS___']", "index": 200 }, { "content": " def setUp(self):\n self.party_1 = Party.objects.create(name='party 1')\n self.party_2 = Party.objects.create(name='party 2')\n self.mk_1 = Member.objects.create(name='mk_1',\n start_date=datetime.date(2010,1,1),\n current_party=self.party_1,\n backlinks_enabled=True)\n self.mk_2 = Member.objects.create(name='mk_2',\n start_date=datetime.date(2010,1,1),\n current_party=self.party_1,\n backlinks_enabled = False)\n self.jacob = User.objects.create_user('jacob', '[email protected]',\n 'JKM')\n\n self.mk_1.save()\n self.mk_2.save()\n\n self.committee_1 = Committee.objects.create(name='c1')\n self.meeting_1 = self.committee_1.meetings.create(date=datetime.date.today()-datetime.timedelta(1),\n protocol_text='jacob:\\nI am a perfectionist\\nadrian:\\nI have a deadline')\n self.meeting_2 = self.committee_1.meetings.create(date=datetime.date.today()-datetime.timedelta(2),\n protocol_text='adrian:\\nYou are a perfectionist\\njacob:\\nYou have a deadline')\n self.law = Law.objects.create(title='law 1')\n self.pp = PrivateProposal.objects.create(title='private proposal 1', date=datetime.date.today()-datetime.timedelta(3))\n self.pp.proposers.add(self.mk_1)\n self.bill_1 = Bill.objects.create(stage='1', title='bill 1', law=self.law)\n self.bill_1.proposals.add(self.pp)\n self.bill_1.proposers.add(self.mk_1)\n self.meeting_1.mks_attended.add(self.mk_1)\n self.meeting_1.save()\n self.meeting_2.mks_attended.add(self.mk_1)\n self.meeting_2.save()\n self.vote = Vote.objects.create(title='vote 1',time=datetime.datetime.now())\n self.vote_action = VoteAction.objects.create(member=self.mk_1, vote=self.vote, type='for', party=self.mk_1.current_party)\n\n self.client = Client(SERVER_NAME='example.com')\n self.xmlrpc_client = TestClientServerProxy('/pingback/')\n self.PINGABLE_MEMBER_ID = str(self.mk_1.id)\n self.NON_PINGABLE_MEMBER_ID = str(self.mk_2.id)", "metadata": "root.MemberBacklinksViewsTest.setUp", "header": "['class', 'MemberBacklinksViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 203 }, { "content": " def trackbackPOSTRequest(self, path, params):\n return self.client.post(path, urlencode(params), content_type=TRACKBACK_CONTENT_TYPE)", "metadata": "root.MemberBacklinksViewsTest.trackbackPOSTRequest", "header": "['class', 'MemberBacklinksViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 243 }, { "content": " def assertTrackBackErrorResponse(self, response, msg):\n if response.content.find('<error>1</error>') == -1:\n raise self.failureException, msg", "metadata": "root.MemberBacklinksViewsTest.assertTrackBackErrorResponse", "header": "['class', 'MemberBacklinksViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 246 }, { "content": " def testPingNonLinkingSourceURI(self):\n self.assertRaises(Fault,\n self.xmlrpc_client.pingback.ping,\n 'http://example.com/bad-source-document/',\n 'http://example.com/member/'+PINGABLE_MEMBER_ID+'/')\n\n try:\n self.xmlrpc_client.pingback.ping('http://example.com/bad-source-document/',\n 'http://example.com/member/'+PINGABLE_MEMBER_ID+'/')\n except Fault, f:\n self.assertEquals(f.faultCode,\n 17,\n 'Server did not return \"source URI does not link\" response')", "metadata": "root.MemberBacklinksViewsTest.testPingNonLinkingSourceURI", "header": "['class', 'MemberBacklinksViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 269 }, { "content": " def testDisallowedMethod(self):\n response = self.client.get('/pingback/')\n self.assertEquals(response.status_code,\n 405,\n 'Server returned incorrect status code for disallowed HTTP method')", "metadata": "root.MemberBacklinksViewsTest.testDisallowedMethod", "header": "['class', 'MemberBacklinksViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 282 }, { "content": " def testNonExistentRPCMethod(self):\n self.assertRaises(Fault, self.xmlrpc_client.foo)", "metadata": "root.MemberBacklinksViewsTest.testNonExistentRPCMethod", "header": "['class', 'MemberBacklinksViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 288 }, { "content": " def testBadPostData(self):\n post_data = urlencode({'sourceURI': 'http://example.com/good-source-document/',\n 'targetURI': 'http://example.com/member/'+PINGABLE_MEMBER_ID+'/'})\n response = self.client.post('/pingback/', post_data, TRACKBACK_CONTENT_TYPE)\n self.assertRaises(Fault,\n loads,\n response.content)", "metadata": "root.MemberBacklinksViewsTest.testBadPostData", "header": "['class', 'MemberBacklinksViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 292 }, { "content": " def testPingNonExistentTargetURI(self):\n self.assertRaises(Fault,\n self.xmlrpc_client.pingback.ping,\n 'http://example.com/member/non-existent-resource/',\n 'http://example.com/member/non-existent-resource')\n try:\n self.xmlrpc_client.pingback.ping('http://example.com/member/non-existent-resource/',\n 'http://example.com/member/non-existent-resource')\n except Fault, f:\n self.assertEquals(f.faultCode,\n 32,\n 'Server did not return \"target does not exist\" error')", "metadata": "root.MemberBacklinksViewsTest.testPingNonExistentTargetURI", "header": "['class', 'MemberBacklinksViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 300 }, { "content": " def testPingAlreadyRegistered(self):\n self.xmlrpc_client.pingback.ping('http://example.com/another-good-source-document/',\n 'http://example.com/member/'+PINGABLE_MEMBER_ID+'/')\n self.assertRaises(Fault,\n self.xmlrpc_client.pingback.ping,\n 'http://example.com/another-good-source-document/',\n 'http://example.com/member/'+PINGABLE_MEMBER_ID+'/')\n\n try:\n self.xmlrpc_client.pingback.ping('http://example.com/another-good-source-document/',\n 'http://example.com/member/'+PINGABLE_MEMBER_ID+'/')\n except Fault, f:\n self.assertEqual(f.faultCode,\n 48,\n 'Server did not return \"ping already registered\" error')", "metadata": "root.MemberBacklinksViewsTest.testPingAlreadyRegistered", "header": "['class', 'MemberBacklinksViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 314 }, { "content": " def testPingbackLinkTemplateTag(self):\n t = template.Template(\"{% load pingback_tags %}{% pingback_link pingback_path %}\")\n c = template.Context({'pingback_path': '/pingback/'})\n rendered = t.render(c)\n link_re = re.compile(r'<link rel=\"pingback\" href=\"([^\"]+)\" ?/?>')\n match = link_re.search(rendered)\n self.assertTrue(bool(match), 'Pingback link tag did not render')\n self.assertEquals(match.groups(0)[0], 'http://example.com/pingback/',\n 'Pingback link tag rendered incorrectly')", "metadata": "root.MemberBacklinksViewsTest.testPingbackLinkTemplateTag", "header": "['class', 'MemberBacklinksViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 330 }, { "content": " def testPingNonPingableTargetURI(self):\n self.assertRaises(Fault,\n self.xmlrpc_client.pingback.ping,\n 'http://example.com/member/non-existent-resource/',\n 'http://example.com/member/'+str(self.NON_PINGABLE_MEMBER_ID)+'/')\n try:\n self.xmlrpc_client.pingback.ping('http://example.com/member/non-existent-resource/',\n 'http://example.com/member/'+str(self.NON_PINGABLE_MEMBER_ID)+'/')\n except Fault, f:\n self.assertEquals(f.faultCode,\n 33,\n 'Server did not return \"target not pingable\" error')", "metadata": "root.MemberBacklinksViewsTest.testPingNonPingableTargetURI", "header": "['class', 'MemberBacklinksViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 340 }, { "content": " def testPingSourceURILinks(self):\n r = self.xmlrpc_client.pingback.ping('http://example.com/good-source-document/',\n 'http://example.com/member/'+self.PINGABLE_MEMBER_ID+'/')\n\n self.assertEquals(r,\n \"Ping from http://example.com/good-source-document/ to http://example.com/member/1/ registered\",\n \"Failed registering ping\")\n\n registered_ping = InboundBacklink.objects.get(source_url='http://example.com/good-source-document/',\n target_url='http://example.com/member/'+self.PINGABLE_MEMBER_ID+'/')\n self.assertEquals(str(registered_ping.target_object.id),\n PINGABLE_MEMBER_ID,\n 'Server did not return \"target not pingable\" error')", "metadata": "root.MemberBacklinksViewsTest.testPingSourceURILinks", "header": "['class', 'MemberBacklinksViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 353 }, { "content": " def testDisallowedTrackbackMethod(self):\n response = self.client.get('/trackback/member/'+PINGABLE_MEMBER_ID+'/')\n self.assertEquals(response.status_code,\n 405,\n 'Server returned incorrect status code for disallowed HTTP method')", "metadata": "root.MemberBacklinksViewsTest.testDisallowedTrackbackMethod", "header": "['class', 'MemberBacklinksViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 367 }, { "content": " def testPingNoURLParameter(self):\n params = {'title': 'Example', 'excerpt': 'Example'}\n response = self.trackbackPOSTRequest('/trackback/member/'+self.PINGABLE_MEMBER_ID+'/',\n params)\n self.assertTrackBackErrorResponse(response,\n 'Server did not return error response'\n 'for ping with no URL parameter')", "metadata": "root.MemberBacklinksViewsTest.testPingNoURLParameter", "header": "['class', 'MemberBacklinksViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 373 }, { "content": " def testPingBadURLParameter(self):\n params = {'url': 'bad url'}\n response = self.trackbackPOSTRequest('http://example.com/trackback/member/'+self.PINGABLE_MEMBER_ID+'/',\n params)\n self.assertTrackBackErrorResponse(response,\n 'Server did not return error response for ping with bad URL parameter')", "metadata": "root.MemberBacklinksViewsTest.testPingBadURLParameter", "header": "['class', 'MemberBacklinksViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 381 }, { "content": " def testPingNonExistentTarget(self):\n params = {'url': 'http://example.com/good-source-document/'}\n response = self.trackbackPOSTRequest('/trackback/member/5000/',\n params)\n self.assertTrackBackErrorResponse(response,\n 'Server did not return error response for ping against non-existent resource')", "metadata": "root.MemberBacklinksViewsTest.testPingNonExistentTarget", "header": "['class', 'MemberBacklinksViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 388 }, { "content": " def testPingNonPingableTarget(self):\n params = {'url': 'http://example.com/member/'+PINGABLE_MEMBER_ID+'/'}\n response = self.trackbackPOSTRequest('/trackback/member/'+self.NON_PINGABLE_MEMBER_ID+'/',\n params)\n self.assertTrackBackErrorResponse(response,\n 'Server did not return error response for ping against non-pingable resource')", "metadata": "root.MemberBacklinksViewsTest.testPingNonPingableTarget", "header": "['class', 'MemberBacklinksViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 395 }, { "content": " def testPingSuccess(self):\n title = 'Backlinks Test - Test Good Source Document'\n excerpt = 'This is a summary of the good source document'\n params = {'url': 'http://example.com/good-source-document/', 'title': title, 'excerpt': excerpt}\n track_target = '/trackback/member/'+self.PINGABLE_MEMBER_ID+'/'\n response = self.trackbackPOSTRequest(track_target,\n params)\n self.assertTrue(response.content.find('<error>0</error>') > -1,\n 'Server did not return success response for a valid ping request')\n registered_ping = InboundBacklink.objects.get(source_url='http://example.com/good-source-document/',\n target_url='http://example.com'+self.mk_1.get_absolute_url())\n self.assertEquals(registered_ping.title,\n title,\n 'Server did not use title from ping request when registering')\n self.assertEquals(registered_ping.excerpt,\n excerpt,\n 'Server did not use excerpt from ping request when registering')", "metadata": "root.MemberBacklinksViewsTest.testPingSuccess", "header": "['class', 'MemberBacklinksViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 402 }, { "content": " def tearDown(self):\n self.party_1.delete()\n self.party_2.delete()\n self.mk_1.delete()\n self.mk_2.delete()\n self.jacob.delete()", "metadata": "root.MemberBacklinksViewsTest.tearDown", "header": "['class', 'MemberBacklinksViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 421 }, { "content": "class MemberAPITests(ResourceTestCase):\n\n", "metadata": "root.MemberAPITests", "header": "['module', '___EOS___']", "index": 428 }, { "content": " def setUp(self):\n super(MemberAPITests, self).setUp()\n\n d = datetime.date.today()\n self.knesset = Knesset.objects.create(\n number=1,\n start_date=d-datetime.timedelta(10))\n self.party_1 = Party.objects.create(name='party 1',\n knesset=self.knesset)\n self.mk_1 = Member.objects.create(name='mk_1',\n start_date=datetime.date(2010,1,1),\n current_party=self.party_1,\n backlinks_enabled=True)\n PersonAlias.objects.create(name=\"mk_1_alias\",\n person=Person.objects.get(mk=self.mk_1))", "metadata": "root.MemberAPITests.setUp", "header": "['class', 'MemberAPITests', '(', 'ResourceTestCase', ')', ':', '___EOS___']", "index": 429 }, { "content": " def testSimpleGet(self):\n res1 = self.api_client.get('/api/v2/member/', data={'name': 'mk_1'})\n self.assertValidJSONResponse(res1)\n ret = self.deserialize(res1)\n self.assertEqual(ret['meta']['total_count'], 1)", "metadata": "root.MemberAPITests.testSimpleGet", "header": "['class', 'MemberAPITests', '(', 'ResourceTestCase', ')', ':', '___EOS___']", "index": 444 }, { "content": " def testAliases(self):\n res1 = self.api_client.get('/api/v2/member/', data={'name': 'mk_1'}, format='json')\n self.assertValidJSONResponse(res1)\n res2 = self.api_client.get('/api/v2/member/', data={'name': 'mk_1_alias'}, format='json')\n self.assertValidJSONResponse(res2)\n self.assertEqual(self.deserialize(res1), self.deserialize(res2))", "metadata": "root.MemberAPITests.testAliases", "header": "['class', 'MemberAPITests', '(', 'ResourceTestCase', ')', ':', '___EOS___']", "index": 450 }, { "content": " def tearDown(self):\n self.mk_1.delete()", "metadata": "root.MemberAPITests.tearDown", "header": "['class', 'MemberAPITests', '(', 'ResourceTestCase', ')', ':', '___EOS___']", "index": 457 }, { "content": "class MemberModelsTests(TestCase):\n", "metadata": "root.MemberModelsTests", "header": "['module', '___EOS___']", "index": 460 }, { "content": " def testNames(self):\n m=Member(name='test member')\n self.assertEqual(m.names, ['test member'])\n m.save()\n MemberAltname(member=m,name='test2').save()\n self.assertEqual(m.names, ['test member','test2'])", "metadata": "root.MemberModelsTests.testNames", "header": "['class', 'MemberModelsTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 462 }, { "content": "class MKAgendasTest(TestCase):\n\n\n\n", "metadata": "root.MKAgendasTest", "header": "['module', '___EOS___']", "index": 471 }, { "content": " def setUp(self):\n self.knesset = Knesset.objects.create(\n number=1,\n start_date=datetime.date(2010, 1, 1))\n self.party_1 = Party.objects.create(\n name='party 1',\n number_of_seats=1,\n knesset=self.knesset)\n self.mk_1 = Member.objects.create(name='mk_1',\n start_date=datetime.date(2010,1,1),\n current_party=self.party_1)\n\n self.mk_2 = Member.objects.create(name='mk_2',\n start_date=datetime.date(2010,1,1),\n current_party=self.party_1)\n\n self.mk_3 = Member.objects.create(name='mk_3',\n start_date=datetime.date(2010,1,1),\n current_party=self.party_1)\n\n self.agenda_1 = Agenda.objects.create(name='agenda 1',\n description='a bloody good agenda 1',\n public_owner_name='Dr. Jacob',\n is_public=True)\n self.agenda_2 = Agenda.objects.create(name='agenda 2',\n description='a bloody good agenda 2',\n public_owner_name='Greenpeace',\n is_public=True)\n self.agenda_3 = Agenda.objects.create(name='agenda 3',\n description='a bloody good agenda 3',\n public_owner_name='Hidden One',\n is_public=False)\n self.vote_1 = Vote.objects.create(title='vote 1',time=datetime.datetime.now())\n self.vote_2 = Vote.objects.create(title='vote 2',time=datetime.datetime.now())\n self.voteactions = [ VoteAction.objects.create(vote=self.vote_1,\n member=self.mk_1, type='for', party=self.mk_1.current_party),\n VoteAction.objects.create(vote=self.vote_2,\n member=self.mk_1, type='for', party=self.mk_1.current_party),\n VoteAction.objects.create(vote=self.vote_1,\n member=self.mk_2, type='against', party=self.mk_2.current_party),\n VoteAction.objects.create(vote=self.vote_2,\n member=self.mk_2, type='against', party=self.mk_2.current_party)\n ]\n self.agendavotes = [AgendaVote.objects.create(agenda=self.agenda_1,\n vote=self.vote_1,\n score=-1,\n reasoning=\"there's got to be a reason 1\"),\n AgendaVote.objects.create(agenda=self.agenda_2,\n vote=self.vote_2,\n score=0.5,\n reasoning=\"there's got to be a reason 2\"),\n AgendaVote.objects.create(agenda=self.agenda_1,\n vote=self.vote_2,\n score=0.5,\n reasoning=\"there's got to be a reason 3\"),\n ]\n\n self.domain = 'http://' + Site.objects.get_current().domain", "metadata": "root.MKAgendasTest.setUp", "header": "['class', 'MKAgendasTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 473 }, { "content": " def testMemberValues(self):\n agenda_values1 = self.mk_1.get_agendas_values()\n self.assertEqual(len(agenda_values1), 2)\n agenda_values2 = self.mk_2.get_agendas_values()\n self.assertEqual(len(agenda_values2), 2)\n self.assertEqual(agenda_values1,\n {1: {'numvotes': 2, 'rank': 2, 'score': -33.33, 'volume': 100.0},\n 2: {'numvotes': 1, 'rank': 1, 'score': 100.0, 'volume': 100.0}})\n self.assertEqual(agenda_values2,\n {1: {'numvotes': 2, 'rank': 1, 'score': 33.33, 'volume': 100.0},\n 2: {'numvotes': 1, 'rank': 2, 'score': -100.0, 'volume': 100.0}})\n agenda_values = self.mk_3.get_agendas_values()\n self.assertFalse(agenda_values)", "metadata": "root.MKAgendasTest.testMemberValues", "header": "['class', 'MKAgendasTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 532 }, { "content": " def testAPIv2(self):\n res = self.client.get('/api/v2/member/%s/?format=json' % self.mk_1.id)\n self.assertEqual(res.status_code, 200)\n data = json.loads(res.content)\n self.assertEqual(data['name'], 'mk_1')\n self.assertEqual(data['party_name'], self.party_1.name)\n self.assertEqual(data['party_url'], self.party_1.get_absolute_url())\n agendas_uri = data['agendas_uri']\n expected_agendas_uri = '/api/v2/member-agendas/%s/' % self.mk_1.id\n self.assertEqual(agendas_uri, expected_agendas_uri, \"Wrong agendas URI returned for member\")\n res2 = self.client.get(expected_agendas_uri+'?format=json')\n agendas = json.loads(res2.content)\n self.assertEqual(agendas['agendas'], [\n {'id': 1, 'owner': 'Dr. Jacob', 'absolute_url': '/agenda/1/',\n 'score': -33.33, 'name': 'agenda 1', 'rank': 2,\n 'min': -33.33, 'max': 33.33,\n 'party_min': -33.33, 'party_max': 33.33,\n },\n {'id': 2, 'owner': 'Greenpeace', 'absolute_url': '/agenda/2/',\n 'score': 100.0, 'name': 'agenda 2', 'rank': 1,\n 'min': -100.0, 'max': 100.0,\n 'party_min': -100.0, 'party_max': 100.0,\n }])", "metadata": "root.MKAgendasTest.testAPIv2", "header": "['class', 'MKAgendasTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 546 }, { "content": " def tearDown(self):\n for av in self.agendavotes:\n av.delete()\n for va in self.voteactions:\n va.delete()\n self.vote_1.delete()\n self.vote_2.delete()\n self.mk_1.delete()\n self.mk_2.delete()\n self.party_1.delete()\n self.agenda_1.delete()\n self.agenda_2.delete()\n self.agenda_3.delete()", "metadata": "root.MKAgendasTest.tearDown", "header": "['class', 'MKAgendasTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 570 } ]
[ { "span": "from django.contrib.auth.models import User, AnonymousUser", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 58 }, { "span": "from actstream import follow,action", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 35 }, { "span": "from actstream.models import Action", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 35 }, { "span": "from mks.models import Member, Party, Membership, MemberAltname, Knesset", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 72 }, { "span": "from mks.views import MemberListView", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 36 }, { "span": "from committees.models import CommitteeMeeting,Committee", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 56 }, { "span": "from knesset.utils import RequestFactory", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 40 }, { "span": "from backlinks.pingback.server import PingbackServer", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 52 }, { "span": "from mks.mock import PINGABLE_MEMBER_ID, NON_PINGABLE_MEMBER_ID", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 63 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "test_", "import_", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "test_", "._", "client_", "import_", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "User_", ",_", "Ano", "nym", "ous", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "sites_", "._", "models_", "import_", "Site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tast", "ypi", "e_", "._", "test_", "import_", "Reso", "urc", "e", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "acts", "tream_", "import_", "follow_", ",_", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "acts", "tream_", "._", "models_", "import_", "Action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mks", "_", "._", "models_", "import_", "Member_", ",_", "Part", "y_", ",_", "Membership", "_", ",_", "Mem", "ber", "Alt", "name_", ",_", "Kn", "esse", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mks", "_", "._", "views_", "import_", "Mem", "ber", "List", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "law", "s_", "._", "models_", "import_", "Law", "_", ",_", "Bill", "_", ",_", "Priva", "te", "Propos", "al_", ",_", "Vote", "_", ",_", "Vote", "Action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "committee", "s_", "._", "models_", "import_", "Committe", "e", "Meet", "ing_", ",_", "Committe", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kne", "sset", "_", "._", "utils_", "import_", "Request", "Factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "feed", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "backli", "nks", "_", "._", "tests_", "._", "xmlrpc", "_", "import_", "Test", "Client", "Server", "Proxy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xmlrpclib_", "import_", "Fault_", ",_", "loads_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "import_", "urlencode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "backli", "nks", "_", "._", "models_", "import_", "Inbo", "und", "Back", "link_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "backli", "nks", "_", "._", "ping", "back_", "._", "server_", "import_", "Ping", "back", "Server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "import_", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mks", "_", "._", "mock_", "import_", "PING", "AB", "LE", "\\u", "MEMBER", "\\u", "ID_", ",_", "NON", "\\u", "PING", "AB", "LE", "\\u", "MEMBER", "\\u", "ID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "persons_", "._", "models_", "import_", "Person_", ",_", "Person", "Alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TRACK", "BACK", "\\u", "CONTE", "NT", "\\u", "TYPE_", "=_", "'", "applica", "tion", "/", "x", "-", "www", "-", "form", "-", "url", "encode", "d", ";", " ", "charset", "=", "utf", "-", "8", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "just", "\\u", "id_", "=_", "lambda_", "x_", ":_", "x_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "agenda", "s_", "._", "models_", "import_", "Age", "nda", "_", ",_", "Age", "nda", "Vote", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Mem", "ber", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "cache", " ", "is", " ", "clean", ",", " ", "to", " ", "prevent", " ", "some", " ", "faili", "ng", " ", "tests", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unexpected", " ", "caches_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "core_", "._", "cache_", "import_", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cache_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "datetime_", "._", "date_", "._", "today_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "kne", "sset", "_", "=_", "Kn", "esse", "t_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "number_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "date_", "=_", "d_", "-_", "datetime_", "._", "timedelta_", "(_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "part", "y", "\\u", "1_", "=_", "Part", "y_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "part", "y", " ", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kne", "sset", "_", "=_", "self_", "._", "kne", "sset", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "part", "y", "\\u", "2_", "=_", "Part", "y_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "part", "y", " ", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kne", "sset", "_", "=_", "self_", "._", "kne", "sset", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mk", "\\u", "1_", "=_", "Member_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "mk", "\\u", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "date_", "=_", "datetime_", "._", "date_", "(_", "2010_", ",_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "party_", "=_", "self_", "._", "part", "y", "\\u", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "backli", "nks", "\\u", "enabled_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mk", "\\u", "2_", "=_", "Member_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "mk", "\\u", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "date_", "=_", "datetime_", "._", "date_", "(_", "2010_", ",_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "party_", "=_", "self_", "._", "part", "y", "\\u", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "backli", "nks", "\\u", "enabled_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "jac", "ob_", "=_", "User_", "._", "objects_", "._", "create", "\\u", "user_", "(_", "'", "jac", "ob", "'_", ",_", "'", "jac", "ob", "@", "jacobian", ".", "org", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "JK", "M", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "committee", "\\u", "1_", "=_", "Committe", "e_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "c1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "meeting", "\\u", "1_", "=_", "self_", "._", "committee", "\\u", "1_", "._", "meeting", "s_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "date_", "=_", "d_", "-_", "datetime_", "._", "timedelta_", "(_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "protoc", "ol", "\\u", "text_", "=_", "'", "jac", "ob", ":\\\\", "n", "I", " ", "am", " ", "a", " ", "perfect", "ioni", "st", "\\\\", "nad", "rian", ":\\\\", "n", "I", " ", "have", " ", "a", " ", "deadl", "ine", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "meeting", "\\u", "2_", "=_", "self_", "._", "committee", "\\u", "1_", "._", "meeting", "s_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "date_", "=_", "d_", "-_", "datetime_", "._", "timedelta_", "(_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "protoc", "ol", "\\u", "text_", "=_", "'", "adr", "ian", ":\\\\", "n", "You", " ", "are", " ", "a", " ", "perfect", "ioni", "st", "\\\\", "nj", "aco", "b", ":\\\\", "n", "You", " ", "have", " ", "a", " ", "deadl", "ine", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "law", "_", "=_", "Law", "_", "._", "objects_", "._", "create_", "(_", "title_", "=_", "'", "law", " ", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pp_", "=_", "Priva", "te", "Propos", "al_", "._", "objects_", "._", "create_", "(_", "title_", "=_", "'", "private", " ", "propos", "al", " ", "1", "'_", ",_", "date_", "=_", "datetime_", "._", "date_", "._", "today_", "(_", ")_", "-_", "datetime_", "._", "timedelta_", "(_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pp_", "._", "propos", "ers_", "._", "add_", "(_", "self_", "._", "mk", "\\u", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bill", "\\u", "1_", "=_", "Bill", "_", "._", "objects_", "._", "create_", "(_", "stage_", "=_", "'", "1", "'_", ",_", "title_", "=_", "'", "bill", " ", "1", "'_", ",_", "law", "_", "=_", "self_", "._", "law", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bill", "\\u", "1_", "._", "proposals", "_", "._", "add_", "(_", "self_", "._", "pp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bill", "\\u", "1_", "._", "propos", "ers_", "._", "add_", "(_", "self_", "._", "mk", "\\u", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "meeting", "\\u", "1_", "._", "mks", "\\u", "attend", "ed_", "._", "add_", "(_", "self_", "._", "mk", "\\u", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "meeting", "\\u", "1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "meeting", "\\u", "2_", "._", "mks", "\\u", "attend", "ed_", "._", "add_", "(_", "self_", "._", "mk", "\\u", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "meeting", "\\u", "2_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vote_", "=_", "Vote", "_", "._", "objects_", "._", "create_", "(_", "title_", "=_", "'", "vote", " ", "1", "'_", ",_", "time_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vote", "\\u", "action_", "=_", "Vote", "Action_", "._", "objects_", "._", "create_", "(_", "member_", "=_", "self_", "._", "mk", "\\u", "1_", ",_", "vote_", "=_", "self_", "._", "vote_", ",_", "type_", "=_", "'", "for", "'_", ",_", "party_", "=_", "self_", "._", "mk", "\\u", "1_", "._", "current", "\\u", "party_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "domain_", "=_", "'", "http", "://'_", "+_", "Site_", "._", "objects_", "._", "get", "\\u", "current_", "(_", ")_", "._", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Mem", "ber", "List_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "self_", "._", "client_", "._", "get_", "(_", "reverse_", "(_", "'", "member", "-", "list", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "status", "\\u", "code_", ",_", "301_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "self_", "._", "client_", "._", "get_", "(_", "reverse_", "(_", "'", "member", "-", "stats", "'_", ",_", "kwargs_", "=_", "{_", "'", "stat", "\\u", "type", "'_", ":_", "'", "bill", "s", "\\u", "pre", "'_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "res_", ",_", "'", "mks", "/", "member", "\\u", "list", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object\\u", "list_", "=_", "res_", "._", "context_", "[_", "'", "object\\u", "list", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Item", "s", "Equal_", "(_", "map_", "(_", "just", "\\u", "id_", ",_", "object\\u", "list_", ")_", ",_", "[_", "self_", "._", "mk", "\\u", "1_", "._", "id_", ",_", "self_", "._", "mk", "\\u", "2_", "._", "id_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Mem", "ber", "Detail_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "self_", "._", "client_", "._", "get_", "(_", "reverse_", "(_", "'", "member", "-", "deta", "il", "'_", ",_", "args_", "=_", "[_", "self_", "._", "mk", "\\u", "1_", "._", "id_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "res_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mks", "/", "member", "\\u", "deta", "il", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "context_", "[_", "'", "object", "'_", "]_", "._", "id_", ",_", "self_", "._", "mk", "\\u", "1_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Mem", "ber", "Det", "ail", "Ot", "her", "Verb", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "s", " ", "the", " ", "member", " ", "deta", "il", " ", "view", " ", "with", " ", "parameter", "s", " ", "tha", "t", " ", "make", " ", "it", " ", "render", "\\", "10", ";", " ", " ", " ", " ", "action", "s", " ", "other", " ", "than", " ", "the", " ", "default", " ", "ones", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'%", "s", "?", "verbs", "=", "attend", "ed", "&", "verbs", "=", "vote", "d", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "'", "member", "-", "deta", "il", "'_", ",_", "args_", "=_", "[_", "self_", "._", "mk", "\\u", "1_", "._", "id_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "res_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mks", "/", "member", "\\u", "deta", "il", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "context_", "[_", "'", "object", "'_", "]_", "._", "id_", ",_", "self_", "._", "mk", "\\u", "1_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Part", "y", "List_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "part", "y", " ", "list", " ", "shou", "ld", " ", "redirec", "t", " ", "to", " ", "stats", " ", "by", " ", "seat", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "self_", "._", "client_", "._", "get_", "(_", "reverse_", "(_", "'", "part", "y", "-", "list", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Redirects_", "(_", "res_", ",_", "reverse_", "(_", "'", "part", "y", "-", "stats", "'_", ",_", "kwargs_", "=_", "{_", "'", "stat", "\\u", "type", "'_", ":_", "'", "seats", "'_", "}_", ")_", ",_", "301_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "assert", "Templa", "te", "Us", "ed", "(", "res", ",", " ", "'", "mks", "/", "part", "y", "\\u", "list", ".", "html", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "object\\u", "list", " ", "=", " ", "res", ".", "context", "['", "object\\u", "list", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "assert", "Equal", "(", "map", "(", "just", "\\u", "id", ",", " ", "object\\u", "list", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "[", " ", "self", ".", "part", "y", "\\u", "1", ".", "id", ",", " ", "self", ".", "part", "y", "\\u", "2", ".", "id", ",", " ", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Part", "y", "Detail_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "self_", "._", "client_", "._", "get_", "(_", "reverse_", "(_", "'", "part", "y", "-", "deta", "il", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "self_", "._", "part", "y", "\\u", "1_", "._", "id_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "res_", ",_", "'", "mks", "/", "part", "y", "\\u", "deta", "il", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "context_", "[_", "'", "object", "'_", "]_", "._", "id_", ",_", "self_", "._", "part", "y", "\\u", "1_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Mem", "ber", "Det", "ail", "s", "Context_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "anonym", "ous", " ", "user_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mk", "\\u", "1", "\\u", "url_", "=_", "self_", "._", "mk", "\\u", "1_", "._", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "self_", "._", "client_", "._", "get_", "(_", "mk", "\\u", "1", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "context_", "[_", "'", "watched", "\\u", "member", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "test", " ", "authe", "rize", "d", " ", "user_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "client_", "._", "login_", "(_", "username_", "=_", "'", "jac", "ob", "'_", ",_", "password_", "=_", "'", "JK", "M", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "self_", "._", "client_", "._", "get_", "(_", "mk", "\\u", "1", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "context_", "[_", "'", "watched", "\\u", "member", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "test", " ", "authe", "rize", "d", " ", "user", " ", "tha", "t", " ", "follow", "s_", "\\u\\u\\uNL\\u\\u\\u_", "follow_", "(_", "self_", "._", "jac", "ob_", ",_", "self_", "._", "mk", "\\u", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "self_", "._", "client_", "._", "get_", "(_", "mk", "\\u", "1", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "._", "context_", "[_", "'", "watched", "\\u", "member", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Mem", "ber", "Activ", "it", "y", "Feed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "self_", "._", "client_", "._", "get_", "(_", "reverse_", "(_", "'", "member", "-", "activit", "y", "-", "feed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "self_", "._", "mk", "\\u", "1_", "._", "id_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parsed_", "=_", "feed", "parser_", "._", "parse_", "(_", "res_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "self", ".", "assert", "Equal", "(", "len", "(", "parsed", "['", "entri", "es", "'])", ",", "4", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "parsed_", "[_", "'", "entri", "es", "'_", "]_", "[_", "0_", "]_", "[_", "'", "link", "'_", "]_", ",_", "self_", "._", "domain_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "vote_", "._", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "parsed_", "[_", "'", "entri", "es", "'_", "]_", "[_", "1_", "]_", "[_", "'", "link", "'_", "]_", ",_", "self_", "._", "domain_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "meeting", "\\u", "1_", "._", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "parsed_", "[_", "'", "entri", "es", "'_", "]_", "[_", "2_", "]_", "[_", "'", "link", "'_", "]_", ",_", "self_", "._", "domain_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "meeting", "\\u", "2_", "._", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "parsed_", "[_", "'", "entri", "es", "'_", "]_", "[_", "3_", "]_", "[_", "'", "link", "'_", "]_", ",_", "self_", "._", "domain_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "bill", "\\u", "1_", "._", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Mem", "ber", "Activ", "it", "y", "Feed", "With", "Verb", "Propos", "ed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "self_", "._", "client_", "._", "get_", "(_", "reverse_", "(_", "'", "member", "-", "activit", "y", "-", "feed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "object\\u", "id", "'_", ":_", "self_", "._", "mk", "\\u", "1_", "._", "id_", "}_", ")_", ",_", "{_", "'", "verbs", "'_", ":_", "'", "proposed", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parsed_", "=_", "feed", "parser_", "._", "parse_", "(_", "res_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "parsed_", "[_", "'", "entri", "es", "'_", "]_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "self_", "._", "client_", "._", "get_", "(_", "reverse_", "(_", "'", "member", "-", "activit", "y", "-", "feed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "object\\u", "id", "'_", ":_", "self_", "._", "mk", "\\u", "2_", "._", "id_", "}_", ")_", ",_", "{_", "'", "verbs", "'_", ":_", "'", "proposed", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parsed_", "=_", "feed", "parser_", "._", "parse_", "(_", "res_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "parsed_", "[_", "'", "entri", "es", "'_", "]_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Mem", "ber", "Activ", "it", "y", "Feed", "With", "Verb", "Attend", "ed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "self_", "._", "client_", "._", "get_", "(_", "reverse_", "(_", "'", "member", "-", "activit", "y", "-", "feed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "object\\u", "id", "'_", ":_", "self_", "._", "mk", "\\u", "1_", "._", "id_", "}_", ")_", ",_", "{_", "'", "verbs", "'_", ":_", "'", "attend", "ed", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parsed_", "=_", "feed", "parser_", "._", "parse_", "(_", "res_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "parsed_", "[_", "'", "entri", "es", "'_", "]_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "self_", "._", "client_", "._", "get_", "(_", "reverse_", "(_", "'", "member", "-", "activit", "y", "-", "feed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "object\\u", "id", "'_", ":_", "self_", "._", "mk", "\\u", "2_", "._", "id_", "}_", ")_", ",_", "{_", "'", "verbs", "'_", ":_", "'", "attend", "ed", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parsed_", "=_", "feed", "parser_", "._", "parse_", "(_", "res_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "parsed_", "[_", "'", "entri", "es", "'_", "]_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Mem", "ber", "Activ", "it", "y", "Feed", "With", "Verb", "Join", "ed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "self_", "._", "client_", "._", "get_", "(_", "reverse_", "(_", "'", "member", "-", "activit", "y", "-", "feed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "object\\u", "id", "'_", ":_", "self_", "._", "mk", "\\u", "1_", "._", "id_", "}_", ")_", ",_", "{_", "'", "verbs", "'_", ":_", "'", "joine", "d", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parsed_", "=_", "feed", "parser_", "._", "parse_", "(_", "res_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "parsed_", "[_", "'", "entri", "es", "'_", "]_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Mem", "ber", "Activ", "it", "y", "Feed", "With", "Verb", "Post", "ed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "self_", "._", "client_", "._", "get_", "(_", "reverse_", "(_", "'", "member", "-", "activit", "y", "-", "feed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "object\\u", "id", "'_", ":_", "self_", "._", "mk", "\\u", "1_", "._", "id_", "}_", ")_", ",_", "{_", "'", "verbs", "'_", ":_", "'", "poste", "d", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parsed_", "=_", "feed", "parser_", "._", "parse_", "(_", "res_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "parsed_", "[_", "'", "entri", "es", "'_", "]_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "part", "y", "\\u", "1_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "part", "y", "\\u", "2_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mk", "\\u", "1_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mk", "\\u", "2_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "jac", "ob_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Mem", "ber", "Back", "link", "s", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "urls_", "=_", "'", "mks", ".", "server", "\\u", "urls", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "test", "Track", "Back", "RDF", "Templa", "te", "Ta", "g", "(", "self", "):", "\\", "10", ";", " ", " ", " ", " ", "t", " ", "=", " ", "template", ".", "Templa", "te", "(\"", "{%", " ", "load", " ", "track", "back", "\\u", "tags", " ", "%}", "{%", " ", "track", "back", "\\u", "rdf", " ", "object\\u", "url", " ", "object\\u", "title", " ", "track", "back", "\\u", "url", " ", "Tru", "e", " ", "%}", "\")", "\\", "10", ";", " ", " ", " ", " ", "c", " ", "=", " ", "template", ".", "Context", "({", "'", "track", "back", "\\u", "url", "':", " ", "'/", "track", "back", "/", "member", "/'", "+", "self", ".", "PING", "AB", "LE", "\\u", "MEMBER", "\\u", "ID", "+'", "/'", ",", "\\", "10", ";", " ", " ", " ", " ", "'", "object\\u", "url", "':", " ", "self", ".", "ping", "able", "Target", "Ur", "l", ",", "\\", "10", ";", " ", " ", " ", " ", "'", "object\\u", "title", "':", " ", "'", "Ping", "able", " ", "Test", " ", "Entr", "y", "'})", "\\", "10", ";", " ", " ", " ", " ", "render", "ed", " ", "=", " ", "t", ".", "render", "(", "c", ")", "\\", "10", ";", " ", " ", " ", " ", "link", "\\u", "re", " ", "=", " ", "re", ".", "compile", "(", "r", "'", "dc", ":", "identifi", "er", "=\"(", "?", "P", "<", "link", ">[", "^", "\"]+", ")\"", "')", "\\", "10", ";", " ", " ", " ", " ", "match", " ", "=", " ", "link", "\\u", "re", ".", "search", "(", "render", "ed", ")", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "assert", "Tru", "e", "(", "bool", "(", "match", "),", " ", "'", "Track", "Back", " ", "RDF", " ", "not", " ", "render", "ed", "')", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "assert", "Equal", "s", "(", "match", ".", "group", "s", "('", "link", "')", "[", "0", "],", " ", "self", ".", "ping", "able", "Target", "Ur", "l", ",", "\\", "10", ";", " ", " ", " ", " ", "'", "Track", "Back", " ", "RDF", " ", "did", " ", "not", " ", "contain", " ", "a", " ", "valid", " ", "target", " ", "URI", "')", "\\", "10", ";", " ", " ", " ", " ", "ping", "\\u", "re", " ", "=", " ", "re", ".", "compile", "(", "r", "'", "track", "back", ":", "ping", "=\"(", "?", "P", "<", "link", ">[", "^", "\"]+", ")\"", "')", "\\", "10", ";", " ", " ", " ", " ", "match", " ", "=", " ", "ping", "\\u", "re", ".", "search", "(", "render", "ed", ")", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "assert", "Tru", "e", "(", "bool", "(", "match", "),", " ", "'", "Track", "Back", " ", "RDF", " ", "not", " ", "render", "ed", "')", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "assert", "Equal", "s", "(", "match", ".", "group", "s", "('", "link", "')", "[", "0", "],", " ", "'/", "track", "back", "/", "member", "/'", "+", "self", ".", "PING", "AB", "LE", "\\u", "MEMBER", "\\u", "ID", "+'", "/'", ",", "\\", "10", ";", " ", " ", " ", " ", "'", "Track", "Back", " ", "RDF", " ", "did", " ", "not", " ", "contain", " ", "a", " ", "Track", "Back", " ", "server", " ", "URI", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "Back", "link", "s", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "part", "y", "\\u", "1_", "=_", "Part", "y_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "part", "y", " ", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "part", "y", "\\u", "2_", "=_", "Part", "y_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "part", "y", " ", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mk", "\\u", "1_", "=_", "Member_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "mk", "\\u", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "date_", "=_", "datetime_", "._", "date_", "(_", "2010_", ",_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "party_", "=_", "self_", "._", "part", "y", "\\u", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "backli", "nks", "\\u", "enabled_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mk", "\\u", "2_", "=_", "Member_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "mk", "\\u", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "date_", "=_", "datetime_", "._", "date_", "(_", "2010_", ",_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "party_", "=_", "self_", "._", "part", "y", "\\u", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "backli", "nks", "\\u", "enabled_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "jac", "ob_", "=_", "User_", "._", "objects_", "._", "create", "\\u", "user_", "(_", "'", "jac", "ob", "'_", ",_", "'", "jac", "ob", "@", "jacobian", ".", "org", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "JK", "M", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mk", "\\u", "1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mk", "\\u", "2_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "committee", "\\u", "1_", "=_", "Committe", "e_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "c1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "meeting", "\\u", "1_", "=_", "self_", "._", "committee", "\\u", "1_", "._", "meeting", "s_", "._", "create_", "(_", "date_", "=_", "datetime_", "._", "date_", "._", "today_", "(_", ")_", "-_", "datetime_", "._", "timedelta_", "(_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "protoc", "ol", "\\u", "text_", "=_", "'", "jac", "ob", ":\\\\", "n", "I", " ", "am", " ", "a", " ", "perfect", "ioni", "st", "\\\\", "nad", "rian", ":\\\\", "n", "I", " ", "have", " ", "a", " ", "deadl", "ine", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "meeting", "\\u", "2_", "=_", "self_", "._", "committee", "\\u", "1_", "._", "meeting", "s_", "._", "create_", "(_", "date_", "=_", "datetime_", "._", "date_", "._", "today_", "(_", ")_", "-_", "datetime_", "._", "timedelta_", "(_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "protoc", "ol", "\\u", "text_", "=_", "'", "adr", "ian", ":\\\\", "n", "You", " ", "are", " ", "a", " ", "perfect", "ioni", "st", "\\\\", "nj", "aco", "b", ":\\\\", "n", "You", " ", "have", " ", "a", " ", "deadl", "ine", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "law", "_", "=_", "Law", "_", "._", "objects_", "._", "create_", "(_", "title_", "=_", "'", "law", " ", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pp_", "=_", "Priva", "te", "Propos", "al_", "._", "objects_", "._", "create_", "(_", "title_", "=_", "'", "private", " ", "propos", "al", " ", "1", "'_", ",_", "date_", "=_", "datetime_", "._", "date_", "._", "today_", "(_", ")_", "-_", "datetime_", "._", "timedelta_", "(_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pp_", "._", "propos", "ers_", "._", "add_", "(_", "self_", "._", "mk", "\\u", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bill", "\\u", "1_", "=_", "Bill", "_", "._", "objects_", "._", "create_", "(_", "stage_", "=_", "'", "1", "'_", ",_", "title_", "=_", "'", "bill", " ", "1", "'_", ",_", "law", "_", "=_", "self_", "._", "law", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bill", "\\u", "1_", "._", "proposals", "_", "._", "add_", "(_", "self_", "._", "pp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bill", "\\u", "1_", "._", "propos", "ers_", "._", "add_", "(_", "self_", "._", "mk", "\\u", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "meeting", "\\u", "1_", "._", "mks", "\\u", "attend", "ed_", "._", "add_", "(_", "self_", "._", "mk", "\\u", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "meeting", "\\u", "1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "meeting", "\\u", "2_", "._", "mks", "\\u", "attend", "ed_", "._", "add_", "(_", "self_", "._", "mk", "\\u", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "meeting", "\\u", "2_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vote_", "=_", "Vote", "_", "._", "objects_", "._", "create_", "(_", "title_", "=_", "'", "vote", " ", "1", "'_", ",_", "time_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vote", "\\u", "action_", "=_", "Vote", "Action_", "._", "objects_", "._", "create_", "(_", "member_", "=_", "self_", "._", "mk", "\\u", "1_", ",_", "vote_", "=_", "self_", "._", "vote_", ",_", "type_", "=_", "'", "for", "'_", ",_", "party_", "=_", "self_", "._", "mk", "\\u", "1_", "._", "current", "\\u", "party_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "client_", "=_", "Client_", "(_", "SERVER", "\\u", "NAME_", "=_", "'", "example", ".", "com", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "xmlrpc", "\\u", "client_", "=_", "Test", "Client", "Server", "Proxy_", "(_", "'/", "ping", "back", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "PING", "AB", "LE", "\\u", "MEMBER", "\\u", "ID_", "=_", "str_", "(_", "self_", "._", "mk", "\\u", "1_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "NON", "\\u", "PING", "AB", "LE", "\\u", "MEMBER", "\\u", "ID_", "=_", "str_", "(_", "self_", "._", "mk", "\\u", "2_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "Back", "link", "s", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "track", "back", "POST", "Request_", "(_", "self_", ",_", "path_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "client_", "._", "post_", "(_", "path_", ",_", "urlencode_", "(_", "params_", ")_", ",_", "content", "\\u", "type_", "=_", "TRACK", "BACK", "\\u", "CONTE", "NT", "\\u", "TYPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "Back", "link", "s", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "assert", "Track", "Back", "Error", "Response_", "(_", "self_", ",_", "response_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "response_", "._", "content_", "._", "find_", "(_", "'<", "error", ">", "1", "</", "error", ">'_", ")_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "self_", "._", "fail", "ure", "Exception_", ",_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "Back", "link", "s", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test", "Ping", "Non", "Link", "ing", "Sou", "rce", "URI_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Fault_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "xmlrpc", "\\u", "client_", "._", "ping", "back_", "._", "ping_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "example", ".", "com", "/", "bad", "-", "source", "-", "document", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "example", ".", "com", "/", "member", "/'_", "+_", "PING", "AB", "LE", "\\u", "MEMBER", "\\u", "ID_", "+_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "xmlrpc", "\\u", "client_", "._", "ping", "back_", "._", "ping_", "(_", "'", "http", "://", "example", ".", "com", "/", "bad", "-", "source", "-", "document", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "example", ".", "com", "/", "member", "/'_", "+_", "PING", "AB", "LE", "\\u", "MEMBER", "\\u", "ID_", "+_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Fault_", ",_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "f_", "._", "fault", "Code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "17_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Server", " ", "did", " ", "not", " ", "return", " ", "\"", "source", " ", "URI", " ", "doe", "s", " ", "not", " ", "link", "\"", " ", "response", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "Back", "link", "s", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Disa", "llow", "ed", "Method_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'/", "ping", "back", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "405_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Server", " ", "return", "ed", " ", "incorrect", " ", "status", " ", "code", " ", "for", " ", "disallow", "ed", " ", "HTTP", " ", "method", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "Back", "link", "s", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Non", "Exist", "ent", "RP", "CM", "ethod", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Fault_", ",_", "self_", "._", "xmlrpc", "\\u", "client_", "._", "foo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "Back", "link", "s", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Ba", "d", "Post", "Data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "post", "\\u", "data_", "=_", "urlencode_", "(_", "{_", "'", "source", "URI", "'_", ":_", "'", "http", "://", "example", ".", "com", "/", "good", "-", "source", "-", "document", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "target", "URI", "'_", ":_", "'", "http", "://", "example", ".", "com", "/", "member", "/'_", "+_", "PING", "AB", "LE", "\\u", "MEMBER", "\\u", "ID_", "+_", "'/'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "post_", "(_", "'/", "ping", "back", "/'_", ",_", "post", "\\u", "data_", ",_", "TRACK", "BACK", "\\u", "CONTE", "NT", "\\u", "TYPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Fault_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "loads_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "Back", "link", "s", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Ping", "Non", "Exist", "ent", "Target", "URI_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Fault_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "xmlrpc", "\\u", "client_", "._", "ping", "back_", "._", "ping_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "example", ".", "com", "/", "member", "/", "non", "-", "existen", "t", "-", "resource", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "example", ".", "com", "/", "member", "/", "non", "-", "existen", "t", "-", "resource", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "xmlrpc", "\\u", "client_", "._", "ping", "back_", "._", "ping_", "(_", "'", "http", "://", "example", ".", "com", "/", "member", "/", "non", "-", "existen", "t", "-", "resource", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "example", ".", "com", "/", "member", "/", "non", "-", "existen", "t", "-", "resource", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Fault_", ",_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "f_", "._", "fault", "Code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "32_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Server", " ", "did", " ", "not", " ", "return", " ", "\"", "target", " ", "doe", "s", " ", "not", " ", "exist", "\"", " ", "error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "Back", "link", "s", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Ping", "Al", "read", "y", "Register", "ed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "xmlrpc", "\\u", "client_", "._", "ping", "back_", "._", "ping_", "(_", "'", "http", "://", "example", ".", "com", "/", "anot", "her", "-", "good", "-", "source", "-", "document", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "example", ".", "com", "/", "member", "/'_", "+_", "PING", "AB", "LE", "\\u", "MEMBER", "\\u", "ID_", "+_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Fault_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "xmlrpc", "\\u", "client_", "._", "ping", "back_", "._", "ping_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "example", ".", "com", "/", "anot", "her", "-", "good", "-", "source", "-", "document", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "example", ".", "com", "/", "member", "/'_", "+_", "PING", "AB", "LE", "\\u", "MEMBER", "\\u", "ID_", "+_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "xmlrpc", "\\u", "client_", "._", "ping", "back_", "._", "ping_", "(_", "'", "http", "://", "example", ".", "com", "/", "anot", "her", "-", "good", "-", "source", "-", "document", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "example", ".", "com", "/", "member", "/'_", "+_", "PING", "AB", "LE", "\\u", "MEMBER", "\\u", "ID_", "+_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Fault_", ",_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "f_", "._", "fault", "Code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "48_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Server", " ", "did", " ", "not", " ", "return", " ", "\"", "ping", " ", "alr", "ead", "y", " ", "register", "ed", "\"", " ", "error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "Back", "link", "s", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Ping", "back", "Link", "Templa", "te", "Tag_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "template_", "._", "Template_", "(_", "\"{", "%", " ", "load", " ", "ping", "back", "\\u", "tags", " ", "%}", "{%", " ", "ping", "back", "\\u", "link", " ", "ping", "back", "\\u", "path", " ", "%}", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "template_", "._", "Context_", "(_", "{_", "'", "ping", "back", "\\u", "path", "'_", ":_", "'/", "ping", "back", "/'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rendered_", "=_", "t_", "._", "render_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link", "\\u", "re_", "=_", "re_", "._", "compile_", "(_", "r", "'<", "link", " ", "rel", "=\"", "ping", "back", "\"", " ", "href", "=\"(", "[", "^", "\"]+", ")\"", " ", "?", "/?", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "match_", "=_", "link", "\\u", "re_", "._", "search_", "(_", "rendered_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "bool_", "(_", "match_", ")_", ",_", "'", "Ping", "back", " ", "link", " ", "tag", " ", "did", " ", "not", " ", "render", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "match_", "._", "groups_", "(_", "0_", ")_", "[_", "0_", "]_", ",_", "'", "http", "://", "example", ".", "com", "/", "ping", "back", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ping", "back", " ", "link", " ", "tag", " ", "render", "ed", " ", "incorrect", "ly", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "Back", "link", "s", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Ping", "Non", "Ping", "able", "Target", "URI_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Fault_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "xmlrpc", "\\u", "client_", "._", "ping", "back_", "._", "ping_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "example", ".", "com", "/", "member", "/", "non", "-", "existen", "t", "-", "resource", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "example", ".", "com", "/", "member", "/'_", "+_", "str_", "(_", "self_", "._", "NON", "\\u", "PING", "AB", "LE", "\\u", "MEMBER", "\\u", "ID_", ")_", "+_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "xmlrpc", "\\u", "client_", "._", "ping", "back_", "._", "ping_", "(_", "'", "http", "://", "example", ".", "com", "/", "member", "/", "non", "-", "existen", "t", "-", "resource", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "example", ".", "com", "/", "member", "/'_", "+_", "str_", "(_", "self_", "._", "NON", "\\u", "PING", "AB", "LE", "\\u", "MEMBER", "\\u", "ID_", ")_", "+_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Fault_", ",_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "f_", "._", "fault", "Code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "33_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Server", " ", "did", " ", "not", " ", "return", " ", "\"", "target", " ", "not", " ", "ping", "able", "\"", " ", "error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "Back", "link", "s", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Ping", "Sou", "rce", "URI", "Links_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "self_", "._", "xmlrpc", "\\u", "client_", "._", "ping", "back_", "._", "ping_", "(_", "'", "http", "://", "example", ".", "com", "/", "good", "-", "source", "-", "document", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "example", ".", "com", "/", "member", "/'_", "+_", "self_", "._", "PING", "AB", "LE", "\\u", "MEMBER", "\\u", "ID_", "+_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ping", " ", "from", " ", "http", "://", "example", ".", "com", "/", "good", "-", "source", "-", "document", "/", " ", "to", " ", "http", "://", "example", ".", "com", "/", "member", "/", "1", "/", " ", "register", "ed", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Fail", "ed", " ", "register", "ing", " ", "ping", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "register", "ed", "\\u", "ping_", "=_", "Inbo", "und", "Back", "link_", "._", "objects_", "._", "get_", "(_", "source", "\\u", "url_", "=_", "'", "http", "://", "example", ".", "com", "/", "good", "-", "source", "-", "document", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target", "\\u", "url_", "=_", "'", "http", "://", "example", ".", "com", "/", "member", "/'_", "+_", "self_", "._", "PING", "AB", "LE", "\\u", "MEMBER", "\\u", "ID_", "+_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "str_", "(_", "register", "ed", "\\u", "ping_", "._", "target", "\\u", "object_", "._", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "PING", "AB", "LE", "\\u", "MEMBER", "\\u", "ID_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Server", " ", "did", " ", "not", " ", "return", " ", "\"", "target", " ", "not", " ", "ping", "able", "\"", " ", "error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "Back", "link", "s", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Disa", "llow", "ed", "Track", "back", "Method_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'/", "track", "back", "/", "member", "/'_", "+_", "PING", "AB", "LE", "\\u", "MEMBER", "\\u", "ID_", "+_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "405_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Server", " ", "return", "ed", " ", "incorrect", " ", "status", " ", "code", " ", "for", " ", "disallow", "ed", " ", "HTTP", " ", "method", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "Back", "link", "s", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Ping", "No", "URL", "Parameter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "=_", "{_", "'", "title", "'_", ":_", "'", "Exam", "ple", "'_", ",_", "'", "exce", "rpt", "'_", ":_", "'", "Exam", "ple", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "track", "back", "POST", "Request_", "(_", "'/", "track", "back", "/", "member", "/'_", "+_", "self_", "._", "PING", "AB", "LE", "\\u", "MEMBER", "\\u", "ID_", "+_", "'/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Track", "Back", "Error", "Response_", "(_", "response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Server", " ", "did", " ", "not", " ", "return", " ", "error", " ", "response", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "for", " ", "ping", " ", "with", " ", "no", " ", "URL", " ", "parameter", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "Back", "link", "s", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Ping", "Ba", "d", "URL", "Parameter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "=_", "{_", "'", "url", "'_", ":_", "'", "bad", " ", "url", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "track", "back", "POST", "Request_", "(_", "'", "http", "://", "example", ".", "com", "/", "track", "back", "/", "member", "/'_", "+_", "self_", "._", "PING", "AB", "LE", "\\u", "MEMBER", "\\u", "ID_", "+_", "'/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Track", "Back", "Error", "Response_", "(_", "response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Server", " ", "did", " ", "not", " ", "return", " ", "error", " ", "response", " ", "for", " ", "ping", " ", "with", " ", "bad", " ", "URL", " ", "parameter", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "Back", "link", "s", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Ping", "Non", "Exist", "ent", "Target_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "=_", "{_", "'", "url", "'_", ":_", "'", "http", "://", "example", ".", "com", "/", "good", "-", "source", "-", "document", "/'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "track", "back", "POST", "Request_", "(_", "'/", "track", "back", "/", "member", "/", "5000", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Track", "Back", "Error", "Response_", "(_", "response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Server", " ", "did", " ", "not", " ", "return", " ", "error", " ", "response", " ", "for", " ", "ping", " ", "against", " ", "non", "-", "existen", "t", " ", "resource", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "Back", "link", "s", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Ping", "Non", "Ping", "able", "Target_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "=_", "{_", "'", "url", "'_", ":_", "'", "http", "://", "example", ".", "com", "/", "member", "/'_", "+_", "PING", "AB", "LE", "\\u", "MEMBER", "\\u", "ID_", "+_", "'/'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "track", "back", "POST", "Request_", "(_", "'/", "track", "back", "/", "member", "/'_", "+_", "self_", "._", "NON", "\\u", "PING", "AB", "LE", "\\u", "MEMBER", "\\u", "ID_", "+_", "'/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Track", "Back", "Error", "Response_", "(_", "response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Server", " ", "did", " ", "not", " ", "return", " ", "error", " ", "response", " ", "for", " ", "ping", " ", "against", " ", "non", "-", "ping", "able", " ", "resource", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "Back", "link", "s", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Ping", "Success_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "title_", "=_", "'", "Back", "link", "s", " ", "Test", " ", "-", " ", "Test", " ", "Good", " ", "Sou", "rce", " ", "Document", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exce", "rpt", "_", "=_", "'", "Thi", "s", " ", "is", " ", "a", " ", "summar", "y", " ", "of", " ", "the", " ", "good", " ", "source", " ", "document", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "{_", "'", "url", "'_", ":_", "'", "http", "://", "example", ".", "com", "/", "good", "-", "source", "-", "document", "/'_", ",_", "'", "title", "'_", ":_", "title_", ",_", "'", "exce", "rpt", "'_", ":_", "exce", "rpt", "_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "track", "\\u", "target_", "=_", "'/", "track", "back", "/", "member", "/'_", "+_", "self_", "._", "PING", "AB", "LE", "\\u", "MEMBER", "\\u", "ID_", "+_", "'/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "track", "back", "POST", "Request_", "(_", "track", "\\u", "target_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "response_", "._", "content_", "._", "find_", "(_", "'<", "error", ">", "0", "</", "error", ">'_", ")_", ">_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Server", " ", "did", " ", "not", " ", "return", " ", "success", " ", "response", " ", "for", " ", "a", " ", "valid", " ", "ping", " ", "request", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register", "ed", "\\u", "ping_", "=_", "Inbo", "und", "Back", "link_", "._", "objects_", "._", "get_", "(_", "source", "\\u", "url_", "=_", "'", "http", "://", "example", ".", "com", "/", "good", "-", "source", "-", "document", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target", "\\u", "url_", "=_", "'", "http", "://", "example", ".", "com", "'_", "+_", "self_", "._", "mk", "\\u", "1_", "._", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "register", "ed", "\\u", "ping_", "._", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Server", " ", "did", " ", "not", " ", "use", " ", "title", " ", "from", " ", "ping", " ", "request", " ", "whe", "n", " ", "register", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "register", "ed", "\\u", "ping_", "._", "exce", "rpt", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exce", "rpt", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Server", " ", "did", " ", "not", " ", "use", " ", "exce", "rpt", " ", "from", " ", "ping", " ", "request", " ", "whe", "n", " ", "register", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "Back", "link", "s", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "part", "y", "\\u", "1_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "part", "y", "\\u", "2_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mk", "\\u", "1_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mk", "\\u", "2_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "jac", "ob_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Mem", "ber", "API", "Tests_", "(_", "Reso", "urc", "e", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "API", "Tests_", "(_", "Reso", "urc", "e", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Mem", "ber", "API", "Tests_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "datetime_", "._", "date_", "._", "today_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "kne", "sset", "_", "=_", "Kn", "esse", "t_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "number_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "date_", "=_", "d_", "-_", "datetime_", "._", "timedelta_", "(_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "part", "y", "\\u", "1_", "=_", "Part", "y_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "part", "y", " ", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kne", "sset", "_", "=_", "self_", "._", "kne", "sset", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mk", "\\u", "1_", "=_", "Member_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "mk", "\\u", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "date_", "=_", "datetime_", "._", "date_", "(_", "2010_", ",_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "party_", "=_", "self_", "._", "part", "y", "\\u", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "backli", "nks", "\\u", "enabled_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Person", "Alias_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "mk", "\\u", "1", "\\u", "alias", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "person_", "=_", "Person_", "._", "objects_", "._", "get_", "(_", "mk", "_", "=_", "self_", "._", "mk", "\\u", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "API", "Tests_", "(_", "Reso", "urc", "e", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Simple", "Get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res1_", "=_", "self_", "._", "api", "\\u", "client_", "._", "get_", "(_", "'/", "api", "/", "v2", "/", "member", "/'_", ",_", "data_", "=_", "{_", "'", "name", "'_", ":_", "'", "mk", "\\u", "1", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Valid", "JSONR", "esp", "ons", "e_", "(_", "res1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "deserialize_", "(_", "res1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "[_", "'", "meta", "'_", "]_", "[_", "'", "total", "\\u", "count", "'_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "API", "Tests_", "(_", "Reso", "urc", "e", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Aliase", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res1_", "=_", "self_", "._", "api", "\\u", "client_", "._", "get_", "(_", "'/", "api", "/", "v2", "/", "member", "/'_", ",_", "data_", "=_", "{_", "'", "name", "'_", ":_", "'", "mk", "\\u", "1", "'_", "}_", ",_", "format_", "=_", "'", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Valid", "JSONR", "esp", "ons", "e_", "(_", "res1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res2_", "=_", "self_", "._", "api", "\\u", "client_", "._", "get_", "(_", "'/", "api", "/", "v2", "/", "member", "/'_", ",_", "data_", "=_", "{_", "'", "name", "'_", ":_", "'", "mk", "\\u", "1", "\\u", "alias", "'_", "}_", ",_", "format_", "=_", "'", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Valid", "JSONR", "esp", "ons", "e_", "(_", "res2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "deserialize_", "(_", "res1_", ")_", ",_", "self_", "._", "deserialize_", "(_", "res2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "API", "Tests_", "(_", "Reso", "urc", "e", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mk", "\\u", "1_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Mem", "ber", "Model", "s", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Mem", "ber", "Model", "s", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test", "Names_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "Member_", "(_", "name_", "=_", "'", "test", " ", "member", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "m_", "._", "names_", ",_", "[_", "'", "test", " ", "member", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mem", "ber", "Alt", "name_", "(_", "member_", "=_", "m_", ",_", "name_", "=_", "'", "test", "2", "'_", ")_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "m_", "._", "names_", ",_", "[_", "'", "test", " ", "member", "'_", ",_", "'", "test", "2", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "MK", "Age", "nda", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "MK", "Age", "nda", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "kne", "sset", "_", "=_", "Kn", "esse", "t_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "number_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "date_", "=_", "datetime_", "._", "date_", "(_", "2010_", ",_", "1_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "part", "y", "\\u", "1_", "=_", "Part", "y_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "part", "y", " ", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "number", "\\u", "of", "\\u", "seats", "_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kne", "sset", "_", "=_", "self_", "._", "kne", "sset", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mk", "\\u", "1_", "=_", "Member_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "mk", "\\u", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "date_", "=_", "datetime_", "._", "date_", "(_", "2010_", ",_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "party_", "=_", "self_", "._", "part", "y", "\\u", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mk", "\\u", "2_", "=_", "Member_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "mk", "\\u", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "date_", "=_", "datetime_", "._", "date_", "(_", "2010_", ",_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "party_", "=_", "self_", "._", "part", "y", "\\u", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mk", "\\u", "3_", "=_", "Member_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "mk", "\\u", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "date_", "=_", "datetime_", "._", "date_", "(_", "2010_", ",_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "party_", "=_", "self_", "._", "part", "y", "\\u", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "agenda", "\\u", "1_", "=_", "Age", "nda", "_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "agenda", " ", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "'", "a", " ", "blood", "y", " ", "good", " ", "agenda", " ", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "public", "\\u", "owner", "\\u", "name_", "=_", "'", "Dr", ".", " ", "Jacob", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "public_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "agenda", "\\u", "2_", "=_", "Age", "nda", "_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "agenda", " ", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "'", "a", " ", "blood", "y", " ", "good", " ", "agenda", " ", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "public", "\\u", "owner", "\\u", "name_", "=_", "'", "Green", "peac", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "public_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "agenda", "\\u", "3_", "=_", "Age", "nda", "_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "agenda", " ", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "'", "a", " ", "blood", "y", " ", "good", " ", "agenda", " ", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "public", "\\u", "owner", "\\u", "name_", "=_", "'", "Hi", "dde", "n", " ", "One", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "public_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vote", "\\u", "1_", "=_", "Vote", "_", "._", "objects_", "._", "create_", "(_", "title_", "=_", "'", "vote", " ", "1", "'_", ",_", "time_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vote", "\\u", "2_", "=_", "Vote", "_", "._", "objects_", "._", "create_", "(_", "title_", "=_", "'", "vote", " ", "2", "'_", ",_", "time_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vote", "actions_", "=_", "[_", "Vote", "Action_", "._", "objects_", "._", "create_", "(_", "vote_", "=_", "self_", "._", "vote", "\\u", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "member_", "=_", "self_", "._", "mk", "\\u", "1_", ",_", "type_", "=_", "'", "for", "'_", ",_", "party_", "=_", "self_", "._", "mk", "\\u", "1_", "._", "current", "\\u", "party_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Vote", "Action_", "._", "objects_", "._", "create_", "(_", "vote_", "=_", "self_", "._", "vote", "\\u", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "member_", "=_", "self_", "._", "mk", "\\u", "1_", ",_", "type_", "=_", "'", "for", "'_", ",_", "party_", "=_", "self_", "._", "mk", "\\u", "1_", "._", "current", "\\u", "party_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Vote", "Action_", "._", "objects_", "._", "create_", "(_", "vote_", "=_", "self_", "._", "vote", "\\u", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "member_", "=_", "self_", "._", "mk", "\\u", "2_", ",_", "type_", "=_", "'", "against", "'_", ",_", "party_", "=_", "self_", "._", "mk", "\\u", "2_", "._", "current", "\\u", "party_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Vote", "Action_", "._", "objects_", "._", "create_", "(_", "vote_", "=_", "self_", "._", "vote", "\\u", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "member_", "=_", "self_", "._", "mk", "\\u", "2_", ",_", "type_", "=_", "'", "against", "'_", ",_", "party_", "=_", "self_", "._", "mk", "\\u", "2_", "._", "current", "\\u", "party_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "agenda", "votes_", "=_", "[_", "Age", "nda", "Vote", "_", "._", "objects_", "._", "create_", "(_", "agenda", "_", "=_", "self_", "._", "agenda", "\\u", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vote_", "=_", "self_", "._", "vote", "\\u", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "score_", "=_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reason", "ing_", "=_", "\"", "there", "'", "s", " ", "got", " ", "to", " ", "be", " ", "a", " ", "reason", " ", "1", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Age", "nda", "Vote", "_", "._", "objects_", "._", "create_", "(_", "agenda", "_", "=_", "self_", "._", "agenda", "\\u", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vote_", "=_", "self_", "._", "vote", "\\u", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "score_", "=_", "0.5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reason", "ing_", "=_", "\"", "there", "'", "s", " ", "got", " ", "to", " ", "be", " ", "a", " ", "reason", " ", "2", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Age", "nda", "Vote", "_", "._", "objects_", "._", "create_", "(_", "agenda", "_", "=_", "self_", "._", "agenda", "\\u", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vote_", "=_", "self_", "._", "vote", "\\u", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "score_", "=_", "0.5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reason", "ing_", "=_", "\"", "there", "'", "s", " ", "got", " ", "to", " ", "be", " ", "a", " ", "reason", " ", "3", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "domain_", "=_", "'", "http", "://'_", "+_", "Site_", "._", "objects_", "._", "get", "\\u", "current_", "(_", ")_", "._", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "MK", "Age", "nda", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Mem", "ber", "Values_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "agenda", "\\u", "values", "1_", "=_", "self_", "._", "mk", "\\u", "1_", "._", "get", "\\u", "agenda", "s", "\\u", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "agenda", "\\u", "values", "1_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "agenda", "\\u", "values", "2_", "=_", "self_", "._", "mk", "\\u", "2_", "._", "get", "\\u", "agenda", "s", "\\u", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "agenda", "\\u", "values", "2_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "agenda", "\\u", "values", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "1_", ":_", "{_", "'", "num", "vote", "s", "'_", ":_", "2_", ",_", "'", "rank", "'_", ":_", "2_", ",_", "'", "score", "'_", ":_", "-_", "33.", "33_", ",_", "'", "volume", "'_", ":_", "100.0_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "{_", "'", "num", "vote", "s", "'_", ":_", "1_", ",_", "'", "rank", "'_", ":_", "1_", ",_", "'", "score", "'_", ":_", "100.0_", ",_", "'", "volume", "'_", ":_", "100.0_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "agenda", "\\u", "values", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "1_", ":_", "{_", "'", "num", "vote", "s", "'_", ":_", "2_", ",_", "'", "rank", "'_", ":_", "1_", ",_", "'", "score", "'_", ":_", "33.", "33_", ",_", "'", "volume", "'_", ":_", "100.0_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "{_", "'", "num", "vote", "s", "'_", ":_", "1_", ",_", "'", "rank", "'_", ":_", "2_", ",_", "'", "score", "'_", ":_", "-_", "100.0_", ",_", "'", "volume", "'_", ":_", "100.0_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "agenda", "\\u", "values_", "=_", "self_", "._", "mk", "\\u", "3_", "._", "get", "\\u", "agenda", "s", "\\u", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "agenda", "\\u", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "MK", "Age", "nda", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "API", "v2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'/", "api", "/", "v2", "/", "member", "/", "%", "s", "/?", "format", "=", "json", "'_", "%_", "self_", "._", "mk", "\\u", "1_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "json_", "._", "loads_", "(_", "res_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "data_", "[_", "'", "name", "'_", "]_", ",_", "'", "mk", "\\u", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "data_", "[_", "'", "part", "y", "\\u", "name", "'_", "]_", ",_", "self_", "._", "part", "y", "\\u", "1_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "data_", "[_", "'", "part", "y", "\\u", "url", "'_", "]_", ",_", "self_", "._", "part", "y", "\\u", "1_", "._", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "agenda", "s", "\\u", "uri_", "=_", "data_", "[_", "'", "agenda", "s", "\\u", "uri", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "agenda", "s", "\\u", "uri_", "=_", "'/", "api", "/", "v2", "/", "member", "-", "agenda", "s", "/", "%", "s", "/'_", "%_", "self_", "._", "mk", "\\u", "1_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "agenda", "s", "\\u", "uri_", ",_", "expected", "\\u", "agenda", "s", "\\u", "uri_", ",_", "\"", "Wro", "ng", " ", "agenda", "s", " ", "URI", " ", "return", "ed", " ", "for", " ", "member", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res2_", "=_", "self_", "._", "client_", "._", "get_", "(_", "expected", "\\u", "agenda", "s", "\\u", "uri_", "+_", "'?", "format", "=", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "agenda", "s_", "=_", "json_", "._", "loads_", "(_", "res2_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "agenda", "s_", "[_", "'", "agenda", "s", "'_", "]_", ",_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "id", "'_", ":_", "1_", ",_", "'", "owner", "'_", ":_", "'", "Dr", ".", " ", "Jacob", "'_", ",_", "'", "abs", "olute", "\\u", "url", "'_", ":_", "'/", "agenda", "/", "1", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "score", "'_", ":_", "-_", "33.", "33_", ",_", "'", "name", "'_", ":_", "'", "agenda", " ", "1", "'_", ",_", "'", "rank", "'_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "min", "'_", ":_", "-_", "33.", "33_", ",_", "'", "max", "'_", ":_", "33.", "33_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "part", "y", "\\u", "min", "'_", ":_", "-_", "33.", "33_", ",_", "'", "part", "y", "\\u", "max", "'_", ":_", "33.", "33_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "id", "'_", ":_", "2_", ",_", "'", "owner", "'_", ":_", "'", "Green", "peac", "e", "'_", ",_", "'", "abs", "olute", "\\u", "url", "'_", ":_", "'/", "agenda", "/", "2", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "score", "'_", ":_", "100.0_", ",_", "'", "name", "'_", ":_", "'", "agenda", " ", "2", "'_", ",_", "'", "rank", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "min", "'_", ":_", "-_", "100.0_", ",_", "'", "max", "'_", ":_", "100.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "part", "y", "\\u", "min", "'_", ":_", "-_", "100.0_", ",_", "'", "part", "y", "\\u", "max", "'_", ":_", "100.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "MK", "Age", "nda", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "av_", "in_", "self_", "._", "agenda", "votes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "av_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "va_", "in_", "self_", "._", "vote", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "va_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "vote", "\\u", "1_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vote", "\\u", "2_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mk", "\\u", "1_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mk", "\\u", "2_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "part", "y", "\\u", "1_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "agenda", "\\u", "1_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "agenda", "\\u", "2_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "agenda", "\\u", "3_", "._", "delete_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
facelessuser/ColorHelper/color_helper.py
[ { "content": " def show_palettes(self, delete=False, color=None, update=False):\n \"\"\"Show preview of all palettes.\"\"\"\n\n show_div = False\n s = sublime.load_settings('color_helper.sublime-settings')\n show_global_palettes = s.get('enable_global_user_palettes', True)\n show_project_palettes = s.get('enable_project_user_palettes', True)\n show_favorite_palette = s.get('enable_favorite_palette', True)\n show_current_palette = s.get('enable_current_file_palette', True)\n s = sublime.load_settings('color_helper.sublime-settings')\n show_picker = s.get('enable_color_picker', True) and self.no_info\n\n html = []\n\n if (not self.no_info and not delete) or color:\n html.append(BACK_INFO_MENU)\n elif delete:\n html.append(BACK_PALETTE_MENU)\n\n if show_picker:\n html.append(PICK_MENU % (color if color else '#ffffffff'))\n\n if not delete and not color and (show_global_palettes or show_project_palettes or show_favorite_palette):\n html.append(DELETE_PALETTE_MENU)\n\n if delete:\n html.append(DELETE_PALETTE)\n\n if color:\n html.append(NEW_PALETTE % {'color': color})\n\n if show_favorite_palette:\n favs = util.get_favs()\n if len(favs['colors']) or color:\n show_div = True\n html.append(\n self.format_palettes(favs['colors'], favs['name'], '__special__', delete=delete, color=color)\n )\n\n if show_current_palette:\n current_colors = self.view.settings().get('color_helper.file_palette', [])\n if not delete and not color and len(current_colors):\n show_div = True\n html.append(\n self.format_palettes(current_colors, \"Current Colors\", '__special__', delete=delete, color=color)\n )\n\n if show_global_palettes:\n palettes = util.get_palettes()\n if len(palettes) and show_div:\n show_div = False\n html.append('\\n\\n---\\n\\n')\n for palette in palettes:\n show_div = True\n name = palette.get(\"name\")\n html.append(\n self.format_palettes(\n palette.get('colors', []), name, '__global__', palette.get('caption'),\n delete=delete,\n color=color\n )\n )\n\n if show_project_palettes:\n palettes = util.get_project_palettes(self.view.window())\n if len(palettes) and show_div:\n show_div = False\n html.append(DIVIDER)\n for palette in palettes:\n name = palette.get(\"name\")\n html.append(\n self.format_palettes(\n palette.get('colors', []), name, '__project__', palette.get('caption'),\n delete=delete,\n color=color\n )\n )\n\n if update:\n md = mdpopups.md2html(self.view, ''.join(html))\n mdpopups.update_popup(\n self.view,\n '<div class=\"color-helper content\">%s</div>' % md,\n css=util.ADD_CSS\n )\n else:\n self.view.settings().set('color_helper.popup_active', True)\n self.view.settings().set('color_helper.popup_auto', self.auto)\n md = mdpopups.md2html(self.view, ''.join(html))\n mdpopups.show_popup(\n self.view, '<div class=\"color-helper content\">%s</div>' % md,\n css=util.ADD_CSS, location=-1, max_width=600, max_height=350,\n on_navigate=self.on_navigate,\n on_hide=self.on_hide,\n flags=sublime.COOPERATE_WITH_AUTO_COMPLETE\n )", "metadata": "root.ColorHelperCommand.show_palettes", "header": "['class', 'ColorHelperCommand', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 788 } ]
[ { "span": "show_div ", "start_line": 854, "start_column": 16, "end_line": 854, "end_column": 24 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Color", "Help", "er", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "show", "\\u", "palette", "s_", "(_", "self_", ",_", "delete_", "=_", "False_", ",_", "color_", "=_", "None_", ",_", "update_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Show", " ", "previe", "w", " ", "of", " ", "all", " ", "palette", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "show", "\\u", "div_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "sublime_", "._", "load", "\\u", "settings_", "(_", "'", "color", "\\u", "help", "er", ".", "sublim", "e-", "settings", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show", "\\u", "global", "\\u", "palette", "s_", "=_", "s_", "._", "get_", "(_", "'", "enable", "\\u", "global", "\\u", "user", "\\u", "palette", "s", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show", "\\u", "project", "\\u", "palette", "s_", "=_", "s_", "._", "get_", "(_", "'", "enable", "\\u", "project", "\\u", "user", "\\u", "palette", "s", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show", "\\u", "favorite", "\\u", "palette_", "=_", "s_", "._", "get_", "(_", "'", "enable", "\\u", "favorite", "\\u", "palette", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show", "\\u", "current", "\\u", "palette_", "=_", "s_", "._", "get_", "(_", "'", "enable", "\\u", "current", "\\u", "file", "\\u", "palette", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "sublime_", "._", "load", "\\u", "settings_", "(_", "'", "color", "\\u", "help", "er", ".", "sublim", "e-", "settings", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show", "\\u", "picker_", "=_", "s_", "._", "get_", "(_", "'", "enable", "\\u", "color", "\\u", "picker", "'_", ",_", "True_", ")_", "and_", "self_", "._", "no", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "html_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "not_", "self_", "._", "no", "\\u", "info_", "and_", "not_", "delete_", ")_", "or_", "color_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html_", "._", "append_", "(_", "BACK", "\\u", "INFO", "\\u", "MENU_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "delete_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html_", "._", "append_", "(_", "BACK", "\\u", "PAL", "ETT", "E", "\\u", "MENU_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "show", "\\u", "picker_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html_", "._", "append_", "(_", "PIC", "K", "\\u", "MENU_", "%_", "(_", "color_", "if_", "color_", "else_", "'#", "ffffff", "ff", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "delete_", "and_", "not_", "color_", "and_", "(_", "show", "\\u", "global", "\\u", "palette", "s_", "or_", "show", "\\u", "project", "\\u", "palette", "s_", "or_", "show", "\\u", "favorite", "\\u", "palette_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html_", "._", "append_", "(_", "DELET", "E", "\\u", "PAL", "ETT", "E", "\\u", "MENU_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "delete_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html_", "._", "append_", "(_", "DELET", "E", "\\u", "PAL", "ETT", "E_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "color_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html_", "._", "append_", "(_", "NEW", "\\u", "PAL", "ETT", "E_", "%_", "{_", "'", "color", "'_", ":_", "color_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "show", "\\u", "favorite", "\\u", "palette_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fav", "s_", "=_", "util_", "._", "get", "\\u", "fav", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "fav", "s_", "[_", "'", "colors", "'_", "]_", ")_", "or_", "color_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "show", "\\u", "div_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "format\\u", "palette", "s_", "(_", "fav", "s_", "[_", "'", "colors", "'_", "]_", ",_", "fav", "s_", "[_", "'", "name", "'_", "]_", ",_", "'\\u", "\\u", "special", "\\u\\u'_", ",_", "delete_", "=_", "delete_", ",_", "color_", "=_", "color_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "show", "\\u", "current", "\\u", "palette_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "\\u", "colors_", "=_", "self_", "._", "view_", "._", "settings_", "(_", ")_", "._", "get_", "(_", "'", "color", "\\u", "help", "er", ".", "file", "\\u", "palette", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "delete_", "and_", "not_", "color_", "and_", "len_", "(_", "current", "\\u", "colors_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "show", "\\u", "div_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "format\\u", "palette", "s_", "(_", "current", "\\u", "colors_", ",_", "\"", "Curr", "ent", " ", "Color", "s", "\"_", ",_", "'\\u", "\\u", "special", "\\u\\u'_", ",_", "delete_", "=_", "delete_", ",_", "color_", "=_", "color_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "show", "\\u", "global", "\\u", "palette", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "palette", "s_", "=_", "util_", "._", "get", "\\u", "palette", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "palette", "s_", ")_", "and_", "show", "\\u", "div_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "show", "\\u", "div_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'\\\\", "n", "\\\\", "n", "---", "\\\\", "n", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "palette_", "in_", "palette", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "show", "\\u", "div_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "palette_", "._", "get_", "(_", "\"", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "format\\u", "palette", "s_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "palette_", "._", "get_", "(_", "'", "colors", "'_", ",_", "[_", "]_", ")_", ",_", "name_", ",_", "'\\u", "\\u", "global", "\\u\\u'_", ",_", "palette_", "._", "get_", "(_", "'", "caption", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "delete_", "=_", "delete_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "color_", "=_", "color_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "show", "\\u", "project", "\\u", "palette", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "palette", "s_", "=_", "util_", "._", "get", "\\u", "project", "\\u", "palette", "s_", "(_", "self_", "._", "view_", "._", "window_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "palette", "s_", ")_", "and_", "show", "\\u", "div_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "show", "\\u", "div_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "DIVI", "DER", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "palette_", "in_", "palette", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "palette_", "._", "get_", "(_", "\"", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "format\\u", "palette", "s_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "palette_", "._", "get_", "(_", "'", "colors", "'_", ",_", "[_", "]_", ")_", ",_", "name_", ",_", "'\\u", "\\u", "project", "\\u\\u'_", ",_", "palette_", "._", "get_", "(_", "'", "caption", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "delete_", "=_", "delete_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "color_", "=_", "color_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "update_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "md_", "=_", "mdp", "opu", "ps_", "._", "md", "2h", "tml_", "(_", "self_", "._", "view_", ",_", "''_", "._", "join_", "(_", "html_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mdp", "opu", "ps_", "._", "update", "\\u", "popup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "view_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "div", " ", "class", "=\"", "color", "-", "help", "er", " ", "content", "\">", "%", "s", "</", "div", ">'_", "%_", "md_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css_", "=_", "util_", "._", "ADD", "\\u", "CS", "S_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "view_", "._", "settings_", "(_", ")_", "._", "set_", "(_", "'", "color", "\\u", "help", "er", ".", "popu", "p", "\\u", "active", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "settings_", "(_", ")_", "._", "set_", "(_", "'", "color", "\\u", "help", "er", ".", "popu", "p", "\\u", "auto", "'_", ",_", "self_", "._", "auto_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md_", "=_", "mdp", "opu", "ps_", "._", "md", "2h", "tml_", "(_", "self_", "._", "view_", ",_", "''_", "._", "join_", "(_", "html_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mdp", "opu", "ps_", "._", "show", "\\u", "popup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "view_", ",_", "'<", "div", " ", "class", "=\"", "color", "-", "help", "er", " ", "content", "\">", "%", "s", "</", "div", ">'_", "%_", "md_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css_", "=_", "util_", "._", "ADD", "\\u", "CS", "S_", ",_", "location_", "=_", "-_", "1_", ",_", "max", "\\u", "width_", "=_", "600_", ",_", "max", "\\u", "height_", "=_", "350_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "navigate", "_", "=_", "self_", "._", "on", "\\u", "navigate", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "hide_", "=_", "self_", "._", "on", "\\u", "hide_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "flags_", "=_", "sublime_", "._", "COO", "PER", "ATE", "\\u", "WITH", "\\u", "AUTO", "\\u", "COMPLETE_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
hwaf/hwaf/py-hwaftools/find_rt.py
[ { "content": "# -*- python -*-\n\n# stdlib imports ---\nimport os\nimport os.path as osp\n\n# waf imports ---\nimport waflib.Utils\nimport waflib.Logs as msg\nfrom waflib.Configure import conf\n\n#\n_heptooldir = osp.dirname(osp.abspath(__file__))\n\n\n\n\n## EOF ##\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def options(ctx):\n ctx.load('hwaf-base', tooldir=_heptooldir)\n return", "metadata": "root.options", "header": "['module', '___EOS___']", "index": 14 }, { "content": "def configure(ctx):\n ctx.load('hwaf-base', tooldir=_heptooldir)\n return", "metadata": "root.configure", "header": "['module', '___EOS___']", "index": 18 }, { "content": "@conf\ndef find_rt(ctx, **kwargs):\n \n ctx.load('hwaf-base', tooldir=_heptooldir)\n\n if not ctx.env.HWAF_FOUND_C_COMPILER:\n ctx.fatal('load a C compiler first')\n pass\n\n if not ctx.is_linux():\n return\n \n # find rt\n ctx.check_with(\n ctx.check,\n \"rt\",\n features='c cprogram',\n lib='rt',\n uselib_store='rt',\n **kwargs\n )\n\n ctx.env.HWAF_FOUND_RT = 1\n return", "metadata": "root.find_rt", "header": "['module', '___EOS___']", "index": 22 } ]
[ { "span": "import os", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 9 }, { "span": "import waflib.Utils", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 19 }, { "span": "import waflib.Logs as msg", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 25 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "python", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "stdlib", " ", "import", "s", " ", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "as_", "osp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "waf", " ", "import", "s", " ", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "waf", "lib_", "._", "Utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "waf", "lib_", "._", "Logs_", "as_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "waf", "lib_", "._", "Configure", "_", "import_", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "hep", "tool", "dir_", "=_", "osp_", "._", "dirname_", "(_", "osp_", "._", "abspath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "EO", "F", " ", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "options_", "(_", "ctx_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "load_", "(_", "'", "hwa", "f", "-", "base", "'_", ",_", "tool", "dir_", "=_", "\\u", "hep", "tool", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "configure_", "(_", "ctx_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "load_", "(_", "'", "hwa", "f", "-", "base", "'_", ",_", "tool", "dir_", "=_", "\\u", "hep", "tool", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "find", "\\u", "rt_", "(_", "ctx_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "load_", "(_", "'", "hwa", "f", "-", "base", "'_", ",_", "tool", "dir_", "=_", "\\u", "hep", "tool", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "ctx_", "._", "env_", "._", "HW", "AF", "\\u", "FO", "UND", "\\u", "C", "\\u", "COMPILER", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "fatal_", "(_", "'", "load", " ", "a", " ", "C", " ", "compiler", " ", "first", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "ctx_", "._", "is", "\\u", "linux_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "rt_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctx_", "._", "check", "\\u", "with_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "ctx_", "._", "check_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "features_", "=_", "'", "c", " ", "cpro", "gram", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lib_", "=_", "'", "rt", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "usel", "ib", "\\u", "store_", "=_", "'", "rt", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kwargs_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ctx_", "._", "env_", "._", "HW", "AF", "\\u", "FO", "UND", "\\u", "RT_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Redundant comparison
OP2/PyOP2/test/unit/test_caching.py
[ { "content": " def test_set_identity(self, backend, base_set, base_set2):\n assert base_set is base_set\n assert base_set is not base_set2\n assert base_set != base_set2\n assert not base_set == base_set2", "metadata": "root.TestObjectCaching.test_set_identity", "header": "['class', 'TestObjectCaching', ':', '___EOS___']", "index": 134 }, { "content": " def test_map_identity(self, backend, base_map, base_map2):\n assert base_map is base_map\n assert base_map is not base_map2\n assert base_map != base_map2\n assert not base_map == base_map2", "metadata": "root.TestObjectCaching.test_map_identity", "header": "['class', 'TestObjectCaching', ':', '___EOS___']", "index": 140 }, { "content": " def test_dataset_cache_hit(self, backend, base_set):\n d1 = base_set ** 2\n d2 = base_set ** 2\n\n assert d1 is d2\n assert d1 == d2\n assert not d1 != d2", "metadata": "root.TestObjectCaching.test_dataset_cache_hit", "header": "['class', 'TestObjectCaching', ':', '___EOS___']", "index": 146 }, { "content": " def test_dataset_cache_miss(self, backend, base_set, base_set2):\n d1 = base_set ** 1\n d2 = base_set ** 2\n\n assert d1 is not d2\n assert d1 != d2\n assert not d1 == d2\n\n d3 = base_set2 ** 1\n assert d1 is not d3\n assert d1 != d3\n assert not d1 == d3", "metadata": "root.TestObjectCaching.test_dataset_cache_miss", "header": "['class', 'TestObjectCaching', ':', '___EOS___']", "index": 154 }, { "content": " def test_mixedset_cache_hit(self, backend, base_set):\n ms = op2.MixedSet([base_set, base_set])\n ms2 = op2.MixedSet([base_set, base_set])\n\n assert ms is ms2\n assert not ms != ms2\n assert ms == ms2", "metadata": "root.TestObjectCaching.test_mixedset_cache_hit", "header": "['class', 'TestObjectCaching', ':', '___EOS___']", "index": 167 }, { "content": " def test_mixedset_cache_miss(self, backend, base_set, base_set2):\n ms = op2.MixedSet([base_set, base_set2])\n ms2 = op2.MixedSet([base_set2, base_set])\n\n assert ms is not ms2\n assert ms != ms2\n assert not ms == ms2\n\n ms3 = op2.MixedSet([base_set, base_set2])\n assert ms is ms3\n assert not ms != ms3\n assert ms == ms3", "metadata": "root.TestObjectCaching.test_mixedset_cache_miss", "header": "['class', 'TestObjectCaching', ':', '___EOS___']", "index": 175 }, { "content": " def test_decoratedmap_cache_hit(self, backend, base_map):\n sm = op2.DecoratedMap(base_map, [op2.ALL])\n\n sm2 = op2.DecoratedMap(base_map, [op2.ALL])\n\n assert sm is sm2\n assert not sm != sm2\n assert sm == sm2", "metadata": "root.TestObjectCaching.test_decoratedmap_cache_hit", "header": "['class', 'TestObjectCaching', ':', '___EOS___']", "index": 188 }, { "content": " def test_decoratedmap_cache_miss(self, backend, base_map, base_map2):\n sm = op2.DecoratedMap(base_map, [op2.ALL])\n sm2 = op2.DecoratedMap(base_map2, [op2.ALL])\n\n assert sm is not sm2\n assert sm != sm2\n assert not sm == sm2\n\n sm3 = op2.DecoratedMap(base_map, [op2.ON_BOTTOM])\n assert sm is not sm3\n assert sm != sm3\n assert not sm == sm3\n\n assert sm2 is not sm3\n assert sm2 != sm3\n assert not sm2 == sm3", "metadata": "root.TestObjectCaching.test_decoratedmap_cache_miss", "header": "['class', 'TestObjectCaching', ':', '___EOS___']", "index": 197 }, { "content": " def test_decoratedmap_le(self, backend, base_map):\n sm = op2.DecoratedMap(base_map, [op2.ALL])\n\n assert base_map <= sm\n assert sm <= base_map\n\n smbc = op2.DecoratedMap(base_map, [op2.ALL], implicit_bcs=[\"top\"])\n\n assert base_map <= smbc\n assert smbc <= base_map\n\n sm2 = op2.DecoratedMap(base_map, [op2.ON_BOTTOM])\n\n assert not base_map <= sm2\n assert not sm2 <= base_map", "metadata": "root.TestObjectCaching.test_decoratedmap_le", "header": "['class', 'TestObjectCaching', ':', '___EOS___']", "index": 229 }, { "content": " def test_mixedmap_cache_hit(self, backend, base_map, base_map2):\n mm = op2.MixedMap([base_map, base_map2])\n mm2 = op2.MixedMap([base_map, base_map2])\n\n assert mm is mm2\n assert not mm != mm2\n assert mm == mm2", "metadata": "root.TestObjectCaching.test_mixedmap_cache_hit", "header": "['class', 'TestObjectCaching', ':', '___EOS___']", "index": 245 }, { "content": " def test_mixedmap_cache_miss(self, backend, base_map, base_map2):\n ms = op2.MixedMap([base_map, base_map2])\n ms2 = op2.MixedMap([base_map2, base_map])\n\n assert ms is not ms2\n assert ms != ms2\n assert not ms == ms2\n\n ms3 = op2.MixedMap([base_map, base_map2])\n assert ms is ms3\n assert not ms != ms3\n assert ms == ms3", "metadata": "root.TestObjectCaching.test_mixedmap_cache_miss", "header": "['class', 'TestObjectCaching', ':', '___EOS___']", "index": 253 }, { "content": " def test_mixeddataset_cache_hit(self, backend, base_set, base_set2):\n mds = op2.MixedDataSet([base_set, base_set2])\n mds2 = op2.MixedDataSet([base_set, base_set2])\n\n assert mds is mds2\n assert not mds != mds2\n assert mds == mds2", "metadata": "root.TestObjectCaching.test_mixeddataset_cache_hit", "header": "['class', 'TestObjectCaching', ':', '___EOS___']", "index": 266 }, { "content": " def test_mixeddataset_cache_miss(self, backend, base_set, base_set2):\n mds = op2.MixedDataSet([base_set, base_set2])\n mds2 = op2.MixedDataSet([base_set2, base_set])\n mds3 = op2.MixedDataSet([base_set, base_set])\n\n assert mds is not mds2\n assert mds != mds2\n assert not mds == mds2\n\n assert mds is not mds3\n assert mds != mds3\n assert not mds == mds3\n\n assert mds2 is not mds3\n assert mds2 != mds3\n assert not mds2 == mds3", "metadata": "root.TestObjectCaching.test_mixeddataset_cache_miss", "header": "['class', 'TestObjectCaching', ':', '___EOS___']", "index": 274 }, { "content": " def test_sparsity_cache_hit(self, backend, base_set, base_map):\n dsets = (base_set, base_set)\n maps = (base_map, base_map)\n sp = op2.Sparsity(dsets, maps)\n sp2 = op2.Sparsity(dsets, maps)\n\n assert sp is sp2\n assert not sp != sp2\n assert sp == sp2\n\n dsets = op2.MixedSet([base_set, base_set])\n\n maps = op2.MixedMap([base_map, base_map])\n sp = op2.Sparsity(dsets, maps)\n\n dsets2 = op2.MixedSet([base_set, base_set])\n maps2 = op2.MixedMap([base_map, base_map])\n sp2 = op2.Sparsity(dsets2, maps2)\n assert sp is sp2\n assert not sp != sp2\n assert sp == sp2", "metadata": "root.TestObjectCaching.test_sparsity_cache_hit", "header": "['class', 'TestObjectCaching', ':', '___EOS___']", "index": 291 }, { "content": " def test_sparsity_cache_miss(self, backend, base_set, base_set2,\n base_map, base_map2):\n dsets = (base_set, base_set)\n maps = (base_map, base_map)\n sp = op2.Sparsity(dsets, maps)\n\n dsets2 = op2.MixedSet([base_set, base_set])\n maps2 = op2.MixedMap([base_map, base_map])\n maps2 = op2.DecoratedMap(maps2, [op2.ALL])\n sp2 = op2.Sparsity(dsets2, maps2)\n assert sp is not sp2\n assert sp != sp2\n assert not sp == sp2\n\n dsets2 = (base_set, base_set2)\n maps2 = (base_map, base_map2)\n\n sp2 = op2.Sparsity(dsets2, maps2)\n assert sp is not sp2\n assert sp != sp2\n assert not sp == sp2", "metadata": "root.TestObjectCaching.test_sparsity_cache_miss", "header": "['class', 'TestObjectCaching', ':', '___EOS___']", "index": 313 } ]
[ { "span": "base_set == base_set2", "start_line": 138, "start_column": 19, "end_line": 138, "end_column": 40 }, { "span": "base_map == base_map2", "start_line": 144, "start_column": 19, "end_line": 144, "end_column": 40 }, { "span": "d1 != d2", "start_line": 152, "start_column": 19, "end_line": 152, "end_column": 27 }, { "span": "d1 == d2", "start_line": 160, "start_column": 19, "end_line": 160, "end_column": 27 }, { "span": "d1 == d3", "start_line": 165, "start_column": 19, "end_line": 165, "end_column": 27 }, { "span": "ms == ms2", "start_line": 173, "start_column": 15, "end_line": 173, "end_column": 24 }, { "span": "ms == ms2", "start_line": 181, "start_column": 19, "end_line": 181, "end_column": 28 }, { "span": "ms == ms3", "start_line": 186, "start_column": 15, "end_line": 186, "end_column": 24 }, { "span": "sm == sm2", "start_line": 195, "start_column": 15, "end_line": 195, "end_column": 24 }, { "span": "sm == sm2", "start_line": 203, "start_column": 19, "end_line": 203, "end_column": 28 }, { "span": "sm == sm3", "start_line": 208, "start_column": 19, "end_line": 208, "end_column": 28 }, { "span": "sm2 == sm3", "start_line": 212, "start_column": 19, "end_line": 212, "end_column": 29 }, { "span": "sm2 <= base_map", "start_line": 243, "start_column": 19, "end_line": 243, "end_column": 34 }, { "span": "mm == mm2", "start_line": 251, "start_column": 15, "end_line": 251, "end_column": 24 }, { "span": "ms == ms2", "start_line": 259, "start_column": 19, "end_line": 259, "end_column": 28 }, { "span": "ms == ms3", "start_line": 264, "start_column": 15, "end_line": 264, "end_column": 24 }, { "span": "mds == mds2", "start_line": 272, "start_column": 15, "end_line": 272, "end_column": 26 }, { "span": "mds == mds2", "start_line": 281, "start_column": 19, "end_line": 281, "end_column": 30 }, { "span": "mds == mds3", "start_line": 285, "start_column": 19, "end_line": 285, "end_column": 30 }, { "span": "mds2 == mds3", "start_line": 289, "start_column": 19, "end_line": 289, "end_column": 31 }, { "span": "sp == sp2", "start_line": 299, "start_column": 15, "end_line": 299, "end_column": 24 }, { "span": "sp == sp2", "start_line": 311, "start_column": 15, "end_line": 311, "end_column": 24 }, { "span": "sp == sp2", "start_line": 325, "start_column": 19, "end_line": 325, "end_column": 28 }, { "span": "sp == sp2", "start_line": 333, "start_column": 19, "end_line": 333, "end_column": 28 } ]
[ { "span": "base_set != base_set2", "start_line": 137, "start_column": 15, "end_line": 137, "end_column": 36 }, { "span": "base_map != base_map2", "start_line": 143, "start_column": 15, "end_line": 143, "end_column": 36 }, { "span": "d1 == d2", "start_line": 151, "start_column": 15, "end_line": 151, "end_column": 23 }, { "span": "d1 != d2", "start_line": 159, "start_column": 15, "end_line": 159, "end_column": 23 }, { "span": "d1 != d3", "start_line": 164, "start_column": 15, "end_line": 164, "end_column": 23 }, { "span": "not ms != ms2", "start_line": 172, "start_column": 15, "end_line": 172, "end_column": 28 }, { "span": "ms != ms2", "start_line": 180, "start_column": 15, "end_line": 180, "end_column": 24 }, { "span": "not ms != ms3", "start_line": 185, "start_column": 15, "end_line": 185, "end_column": 28 }, { "span": "not sm != sm2", "start_line": 194, "start_column": 15, "end_line": 194, "end_column": 28 }, { "span": "sm != sm2", "start_line": 202, "start_column": 15, "end_line": 202, "end_column": 24 }, { "span": "sm != sm3", "start_line": 207, "start_column": 15, "end_line": 207, "end_column": 24 }, { "span": "sm2 != sm3", "start_line": 211, "start_column": 15, "end_line": 211, "end_column": 25 }, { "span": "not base_map <= sm2", "start_line": 242, "start_column": 15, "end_line": 242, "end_column": 34 }, { "span": "not mm != mm2", "start_line": 250, "start_column": 15, "end_line": 250, "end_column": 28 }, { "span": "ms != ms2", "start_line": 258, "start_column": 15, "end_line": 258, "end_column": 24 }, { "span": "not ms != ms3", "start_line": 263, "start_column": 15, "end_line": 263, "end_column": 28 }, { "span": "not mds != mds2", "start_line": 271, "start_column": 15, "end_line": 271, "end_column": 30 }, { "span": "mds != mds2", "start_line": 280, "start_column": 15, "end_line": 280, "end_column": 26 }, { "span": "mds != mds3", "start_line": 284, "start_column": 15, "end_line": 284, "end_column": 26 }, { "span": "mds2 != mds3", "start_line": 288, "start_column": 15, "end_line": 288, "end_column": 27 }, { "span": "not sp != sp2", "start_line": 298, "start_column": 15, "end_line": 298, "end_column": 28 }, { "span": "not sp != sp2", "start_line": 310, "start_column": 15, "end_line": 310, "end_column": 28 }, { "span": "sp != sp2", "start_line": 324, "start_column": 15, "end_line": 324, "end_column": 24 }, { "span": "sp != sp2", "start_line": 332, "start_column": 15, "end_line": 332, "end_column": 24 } ]
1
true
[ "[CLS]_", "Redu", "ndan", "t_", "comparison_", "[SEP]_", "class_", "Test", "Object", "Caching", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "set\\u", "identity_", "(_", "self_", ",_", "backend_", ",_", "base", "\\u", "set_", ",_", "base", "\\u", "set", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "base", "\\u", "set_", "is_", "base", "\\u", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "base", "\\u", "set_", "is_", "not_", "base", "\\u", "set", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "base", "\\u", "set_", "!=_", "base", "\\u", "set", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "base", "\\u", "set_", "==_", "base", "\\u", "set", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Object", "Caching", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "map", "\\u", "identity_", "(_", "self_", ",_", "backend_", ",_", "base", "\\u", "map_", ",_", "base", "\\u", "map", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "base", "\\u", "map_", "is_", "base", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "base", "\\u", "map_", "is_", "not_", "base", "\\u", "map", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "base", "\\u", "map_", "!=_", "base", "\\u", "map", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "base", "\\u", "map_", "==_", "base", "\\u", "map", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Object", "Caching", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "dataset", "\\u", "cache", "\\u", "hit_", "(_", "self_", ",_", "backend_", ",_", "base", "\\u", "set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d1_", "=_", "base", "\\u", "set_", "**_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d2_", "=_", "base", "\\u", "set_", "**_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "d1_", "is_", "d2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d1_", "==_", "d2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "d1_", "!=_", "d2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Object", "Caching", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "dataset", "\\u", "cache", "\\u", "miss", "_", "(_", "self_", ",_", "backend_", ",_", "base", "\\u", "set_", ",_", "base", "\\u", "set", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d1_", "=_", "base", "\\u", "set_", "**_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d2_", "=_", "base", "\\u", "set_", "**_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "d1_", "is_", "not_", "d2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d1_", "!=_", "d2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "d1_", "==_", "d2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d3_", "=_", "base", "\\u", "set", "2_", "**_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d1_", "is_", "not_", "d3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d1_", "!=_", "d3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "d1_", "==_", "d3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Object", "Caching", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mixed", "set\\u", "cache", "\\u", "hit_", "(_", "self_", ",_", "backend_", ",_", "base", "\\u", "set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ms_", "=_", "op2_", "._", "Mix", "ed", "Set_", "(_", "[_", "base", "\\u", "set_", ",_", "base", "\\u", "set_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ms", "2_", "=_", "op2_", "._", "Mix", "ed", "Set_", "(_", "[_", "base", "\\u", "set_", ",_", "base", "\\u", "set_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "ms_", "is_", "ms", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "ms_", "!=_", "ms", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ms_", "==_", "ms", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Object", "Caching", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mixed", "set\\u", "cache", "\\u", "miss", "_", "(_", "self_", ",_", "backend_", ",_", "base", "\\u", "set_", ",_", "base", "\\u", "set", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ms_", "=_", "op2_", "._", "Mix", "ed", "Set_", "(_", "[_", "base", "\\u", "set_", ",_", "base", "\\u", "set", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ms", "2_", "=_", "op2_", "._", "Mix", "ed", "Set_", "(_", "[_", "base", "\\u", "set", "2_", ",_", "base", "\\u", "set_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "ms_", "is_", "not_", "ms", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ms_", "!=_", "ms", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "ms_", "==_", "ms", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ms", "3_", "=_", "op2_", "._", "Mix", "ed", "Set_", "(_", "[_", "base", "\\u", "set_", ",_", "base", "\\u", "set", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ms_", "is_", "ms", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "ms_", "!=_", "ms", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ms_", "==_", "ms", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Object", "Caching", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "decorated", "map", "\\u", "cache", "\\u", "hit_", "(_", "self_", ",_", "backend_", ",_", "base", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sm_", "=_", "op2_", "._", "Decorat", "ed", "Map_", "(_", "base", "\\u", "map_", ",_", "[_", "op2_", "._", "ALL_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sm", "2_", "=_", "op2_", "._", "Decorat", "ed", "Map_", "(_", "base", "\\u", "map_", ",_", "[_", "op2_", "._", "ALL_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "sm_", "is_", "sm", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "sm_", "!=_", "sm", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "sm_", "==_", "sm", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Object", "Caching", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "decorated", "map", "\\u", "cache", "\\u", "miss", "_", "(_", "self_", ",_", "backend_", ",_", "base", "\\u", "map_", ",_", "base", "\\u", "map", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sm_", "=_", "op2_", "._", "Decorat", "ed", "Map_", "(_", "base", "\\u", "map_", ",_", "[_", "op2_", "._", "ALL_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sm", "2_", "=_", "op2_", "._", "Decorat", "ed", "Map_", "(_", "base", "\\u", "map", "2_", ",_", "[_", "op2_", "._", "ALL_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "sm_", "is_", "not_", "sm", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "sm_", "!=_", "sm", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "sm_", "==_", "sm", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sm", "3_", "=_", "op2_", "._", "Decorat", "ed", "Map_", "(_", "base", "\\u", "map_", ",_", "[_", "op2_", "._", "ON", "\\u", "BOTTOM_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "sm_", "is_", "not_", "sm", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "sm_", "!=_", "sm", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "sm_", "==_", "sm", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "sm", "2_", "is_", "not_", "sm", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "sm", "2_", "!=_", "sm", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "sm", "2_", "==_", "sm", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Object", "Caching", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "decorated", "map", "\\u", "le_", "(_", "self_", ",_", "backend_", ",_", "base", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sm_", "=_", "op2_", "._", "Decorat", "ed", "Map_", "(_", "base", "\\u", "map_", ",_", "[_", "op2_", "._", "ALL_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "base", "\\u", "map_", "<=_", "sm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "sm_", "<=_", "base", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "smb", "c_", "=_", "op2_", "._", "Decorat", "ed", "Map_", "(_", "base", "\\u", "map_", ",_", "[_", "op2_", "._", "ALL_", "]_", ",_", "implicit", "\\u", "bcs", "_", "=_", "[_", "\"", "top", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "base", "\\u", "map_", "<=_", "smb", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "smb", "c_", "<=_", "base", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sm", "2_", "=_", "op2_", "._", "Decorat", "ed", "Map_", "(_", "base", "\\u", "map_", ",_", "[_", "op2_", "._", "ON", "\\u", "BOTTOM_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "not_", "base", "\\u", "map_", "<=_", "sm", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "sm", "2_", "<=_", "base", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Object", "Caching", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mixed", "map", "\\u", "cache", "\\u", "hit_", "(_", "self_", ",_", "backend_", ",_", "base", "\\u", "map_", ",_", "base", "\\u", "map", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mm_", "=_", "op2_", "._", "Mix", "ed", "Map_", "(_", "[_", "base", "\\u", "map_", ",_", "base", "\\u", "map", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mm", "2_", "=_", "op2_", "._", "Mix", "ed", "Map_", "(_", "[_", "base", "\\u", "map_", ",_", "base", "\\u", "map", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "mm_", "is_", "mm", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "mm_", "!=_", "mm", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "mm_", "==_", "mm", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Object", "Caching", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mixed", "map", "\\u", "cache", "\\u", "miss", "_", "(_", "self_", ",_", "backend_", ",_", "base", "\\u", "map_", ",_", "base", "\\u", "map", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ms_", "=_", "op2_", "._", "Mix", "ed", "Map_", "(_", "[_", "base", "\\u", "map_", ",_", "base", "\\u", "map", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ms", "2_", "=_", "op2_", "._", "Mix", "ed", "Map_", "(_", "[_", "base", "\\u", "map", "2_", ",_", "base", "\\u", "map_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "ms_", "is_", "not_", "ms", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ms_", "!=_", "ms", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "ms_", "==_", "ms", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ms", "3_", "=_", "op2_", "._", "Mix", "ed", "Map_", "(_", "[_", "base", "\\u", "map_", ",_", "base", "\\u", "map", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ms_", "is_", "ms", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "ms_", "!=_", "ms", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ms_", "==_", "ms", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Object", "Caching", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mixed", "dataset", "\\u", "cache", "\\u", "hit_", "(_", "self_", ",_", "backend_", ",_", "base", "\\u", "set_", ",_", "base", "\\u", "set", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mds", "_", "=_", "op2_", "._", "Mix", "ed", "Data", "Set_", "(_", "[_", "base", "\\u", "set_", ",_", "base", "\\u", "set", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mds", "2_", "=_", "op2_", "._", "Mix", "ed", "Data", "Set_", "(_", "[_", "base", "\\u", "set_", ",_", "base", "\\u", "set", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "mds", "_", "is_", "mds", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "mds", "_", "!=_", "mds", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "mds", "_", "==_", "mds", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Object", "Caching", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mixed", "dataset", "\\u", "cache", "\\u", "miss", "_", "(_", "self_", ",_", "backend_", ",_", "base", "\\u", "set_", ",_", "base", "\\u", "set", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mds", "_", "=_", "op2_", "._", "Mix", "ed", "Data", "Set_", "(_", "[_", "base", "\\u", "set_", ",_", "base", "\\u", "set", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mds", "2_", "=_", "op2_", "._", "Mix", "ed", "Data", "Set_", "(_", "[_", "base", "\\u", "set", "2_", ",_", "base", "\\u", "set_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mds", "3_", "=_", "op2_", "._", "Mix", "ed", "Data", "Set_", "(_", "[_", "base", "\\u", "set_", ",_", "base", "\\u", "set_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "mds", "_", "is_", "not_", "mds", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "mds", "_", "!=_", "mds", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "mds", "_", "==_", "mds", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "mds", "_", "is_", "not_", "mds", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "mds", "_", "!=_", "mds", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "mds", "_", "==_", "mds", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "mds", "2_", "is_", "not_", "mds", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "mds", "2_", "!=_", "mds", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "mds", "2_", "==_", "mds", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Object", "Caching", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "sparsity", "\\u", "cache", "\\u", "hit_", "(_", "self_", ",_", "backend_", ",_", "base", "\\u", "set_", ",_", "base", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dset", "s_", "=_", "(_", "base", "\\u", "set_", ",_", "base", "\\u", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "maps_", "=_", "(_", "base", "\\u", "map_", ",_", "base", "\\u", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sp_", "=_", "op2_", "._", "Spar", "sity", "_", "(_", "dset", "s_", ",_", "maps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sp", "2_", "=_", "op2_", "._", "Spar", "sity", "_", "(_", "dset", "s_", ",_", "maps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "sp_", "is_", "sp", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "sp_", "!=_", "sp", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "sp_", "==_", "sp", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dset", "s_", "=_", "op2_", "._", "Mix", "ed", "Set_", "(_", "[_", "base", "\\u", "set_", ",_", "base", "\\u", "set_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "maps_", "=_", "op2_", "._", "Mix", "ed", "Map_", "(_", "[_", "base", "\\u", "map_", ",_", "base", "\\u", "map_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sp_", "=_", "op2_", "._", "Spar", "sity", "_", "(_", "dset", "s_", ",_", "maps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dset", "s2_", "=_", "op2_", "._", "Mix", "ed", "Set_", "(_", "[_", "base", "\\u", "set_", ",_", "base", "\\u", "set_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "maps", "2_", "=_", "op2_", "._", "Mix", "ed", "Map_", "(_", "[_", "base", "\\u", "map_", ",_", "base", "\\u", "map_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sp", "2_", "=_", "op2_", "._", "Spar", "sity", "_", "(_", "dset", "s2_", ",_", "maps", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "sp_", "is_", "sp", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "sp_", "!=_", "sp", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "sp_", "==_", "sp", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Object", "Caching", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "sparsity", "\\u", "cache", "\\u", "miss", "_", "(_", "self_", ",_", "backend_", ",_", "base", "\\u", "set_", ",_", "base", "\\u", "set", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "map_", ",_", "base", "\\u", "map", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dset", "s_", "=_", "(_", "base", "\\u", "set_", ",_", "base", "\\u", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "maps_", "=_", "(_", "base", "\\u", "map_", ",_", "base", "\\u", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sp_", "=_", "op2_", "._", "Spar", "sity", "_", "(_", "dset", "s_", ",_", "maps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dset", "s2_", "=_", "op2_", "._", "Mix", "ed", "Set_", "(_", "[_", "base", "\\u", "set_", ",_", "base", "\\u", "set_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "maps", "2_", "=_", "op2_", "._", "Mix", "ed", "Map_", "(_", "[_", "base", "\\u", "map_", ",_", "base", "\\u", "map_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "maps", "2_", "=_", "op2_", "._", "Decorat", "ed", "Map_", "(_", "maps", "2_", ",_", "[_", "op2_", "._", "ALL_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sp", "2_", "=_", "op2_", "._", "Spar", "sity", "_", "(_", "dset", "s2_", ",_", "maps", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "sp_", "is_", "not_", "sp", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "sp_", "!=_", "sp", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "sp_", "==_", "sp", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dset", "s2_", "=_", "(_", "base", "\\u", "set_", ",_", "base", "\\u", "set", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "maps", "2_", "=_", "(_", "base", "\\u", "map_", ",_", "base", "\\u", "map", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sp", "2_", "=_", "op2_", "._", "Spar", "sity", "_", "(_", "dset", "s2_", ",_", "maps", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "sp_", "is_", "not_", "sp", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "sp_", "!=_", "sp", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "sp_", "==_", "sp", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 2, 2, 2, 0, 1, 1, 1, 2 ]
Unused import
pudo/opennames/pepparser/model.py
[ { "content": "import json\nfrom copy import deepcopy\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class EntityManager(object):\n\n\n\n\n", "metadata": "root.EntityManager", "header": "['module', '___EOS___']", "index": 4 }, { "content": " def __init__(self, engine):\n self.engine = engine\n self._entities = engine['pep_entity']\n self._other_names = engine['pep_other_name']\n self._identities = engine['pep_identity']\n self._addresses = engine['pep_address']", "metadata": "root.EntityManager.__init__", "header": "['class', 'EntityManager', '(', 'object', ')', ':', '___EOS___']", "index": 6 }, { "content": " def _clear_table(self, table, uids):\n if 'uid' not in table.table.c:\n return\n q = table.table.delete().where(table.table.c.uid.in_(uids))\n self.engine.executable.execute(q)", "metadata": "root.EntityManager._clear_table", "header": "['class', 'EntityManager', '(', 'object', ')', ':', '___EOS___']", "index": 13 }, { "content": " def _pad_rows(self, rows):\n keys = set([])\n for row in rows:\n keys.update(row.keys())\n for row in rows:\n for key in keys:\n if key not in row:\n row[key] = None\n return rows", "metadata": "root.EntityManager._pad_rows", "header": "['class', 'EntityManager', '(', 'object', ')', ':', '___EOS___']", "index": 19 }, { "content": " def clear_entities(self, entities):\n uids = [e.get('uid') for e in entities]\n self._clear_table(self._entities, uids)\n self._clear_table(self._identities, uids)\n self._clear_table(self._other_names, uids)\n self._clear_table(self._addresses, uids)", "metadata": "root.EntityManager.clear_entities", "header": "['class', 'EntityManager', '(', 'object', ')', ':', '___EOS___']", "index": 29 }, { "content": " def save_entities(self, entities):\n self.clear_entities(entities)\n\n identities = []\n other_names = []\n addresses = []\n\n for entity in entities:\n entity['json'] = json.dumps(entity)\n base = {\n 'uid': entity.get('uid'),\n 'name': entity.get('name')\n }\n\n for identity in entity.pop('identities', []):\n identity.update(base)\n identities.append(identity)\n\n for other_name in entity.pop('other_names', []):\n other_name.update(base)\n other_names.append(other_name)\n\n for address in entity.pop('addresses', []):\n address.update(base)\n addresses.append(address)\n\n self._entities.insert_many(self._pad_rows(entities))\n self._identities.insert_many(self._pad_rows(identities))\n self._other_names.insert_many(self._pad_rows(other_names))\n self._addresses.insert_many(self._pad_rows(addresses))", "metadata": "root.EntityManager.save_entities", "header": "['class', 'EntityManager', '(', 'object', ')', ':', '___EOS___']", "index": 36 } ]
[ { "span": "from copy import deepcopy", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 25 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "copy_", "import_", "deepcopy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Entit", "y", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Entit", "y", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "engine_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "engine_", "=_", "engine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "entities_", "=_", "engine_", "[_", "'", "pep", "\\u", "entity", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "other", "\\u", "names_", "=_", "engine_", "[_", "'", "pep", "\\u", "other", "\\u", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "identities", "_", "=_", "engine_", "[_", "'", "pep", "\\u", "identi", "ty", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "addresses_", "=_", "engine_", "[_", "'", "pep", "\\u", "address", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Entit", "y", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "clear", "\\u", "table_", "(_", "self_", ",_", "table_", ",_", "uids_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "uid", "'_", "not_", "in_", "table_", "._", "table_", "._", "c_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "q_", "=_", "table_", "._", "table_", "._", "delete_", "(_", ")_", "._", "where_", "(_", "table_", "._", "table_", "._", "c_", "._", "uid_", "._", "in\\u_", "(_", "uids_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "engine_", "._", "executable_", "._", "execute_", "(_", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Entit", "y", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "pad", "\\u", "rows_", "(_", "self_", ",_", "rows_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keys_", "=_", "set_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keys_", "._", "update_", "(_", "row_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "row_", "in_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", "in_", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "not_", "in_", "row_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "row_", "[_", "key_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "rows_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Entit", "y", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "entities_", "(_", "self_", ",_", "entities_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uids_", "=_", "[_", "e_", "._", "get_", "(_", "'", "uid", "'_", ")_", "for_", "e_", "in_", "entities_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "clear", "\\u", "table_", "(_", "self_", "._", "\\u", "entities_", ",_", "uids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "clear", "\\u", "table_", "(_", "self_", "._", "\\u", "identities", "_", ",_", "uids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "clear", "\\u", "table_", "(_", "self_", "._", "\\u", "other", "\\u", "names_", ",_", "uids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "clear", "\\u", "table_", "(_", "self_", "._", "\\u", "addresses_", ",_", "uids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Entit", "y", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "entities_", "(_", "self_", ",_", "entities_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "clear", "\\u", "entities_", "(_", "entities_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "identities", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other", "\\u", "names_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addresses_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "entity_", "in_", "entities_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "entity_", "[_", "'", "json", "'_", "]_", "=_", "json_", "._", "dumps_", "(_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "uid", "'_", ":_", "entity_", "._", "get_", "(_", "'", "uid", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "entity_", "._", "get_", "(_", "'", "name", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "identity_", "in_", "entity_", "._", "pop_", "(_", "'", "identities", "'_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "identity_", "._", "update_", "(_", "base_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "identities", "_", "._", "append_", "(_", "identity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "other", "\\u", "name_", "in_", "entity_", "._", "pop_", "(_", "'", "other", "\\u", "names", "'_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "other", "\\u", "name_", "._", "update_", "(_", "base_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other", "\\u", "names_", "._", "append_", "(_", "other", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "address_", "in_", "entity_", "._", "pop_", "(_", "'", "addresse", "s", "'_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "address_", "._", "update_", "(_", "base_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addresses_", "._", "append_", "(_", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "entities_", "._", "insert", "\\u", "many_", "(_", "self_", "._", "\\u", "pad", "\\u", "rows_", "(_", "entities_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "identities", "_", "._", "insert", "\\u", "many_", "(_", "self_", "._", "\\u", "pad", "\\u", "rows_", "(_", "identities", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "other", "\\u", "names_", "._", "insert", "\\u", "many_", "(_", "self_", "._", "\\u", "pad", "\\u", "rows_", "(_", "other", "\\u", "names_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "addresses_", "._", "insert", "\\u", "many_", "(_", "self_", "._", "\\u", "pad", "\\u", "rows_", "(_", "addresses_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
First argument to super() is not enclosing class
adamchainz/django-mysql/django_mysql/models/expressions.py
[ { "content": " def __init__(self, lhs):\n super(BaseExpression, self).__init__()\n self.lhs = lhs", "metadata": "root.PopListF.__init__", "header": "['class', 'PopListF', '(', 'BaseExpression', ')', ':', '___EOS___']", "index": 127 }, { "content": " def __init__(self, lhs):\n super(BaseExpression, self).__init__()\n self.lhs = lhs", "metadata": "root.PopLeftListF.__init__", "header": "['class', 'PopLeftListF', '(', 'BaseExpression', ')', ':', '___EOS___']", "index": 154 } ]
[ { "span": "super(BaseExpression, self).", "start_line": 128, "start_column": 8, "end_line": 128, "end_column": 35 }, { "span": "super(BaseExpression, self).", "start_line": 155, "start_column": 8, "end_line": 155, "end_column": 35 } ]
[]
1
true
[ "[CLS]_", "First_", "argument_", "to_", "super_", "(_", ")_", "is_", "not_", "encl", "osin", "g_", "class_", "[SEP]_", "class_", "Pop", "List", "F_", "(_", "Base", "Expression_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "lhs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Base", "Expression_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lhs_", "=_", "lhs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pop", "Le", "ft", "List", "F_", "(_", "Base", "Expression_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "lhs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Base", "Expression_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lhs_", "=_", "lhs_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
tobych/django-feature-flipper/featureflipper_example/views.py
[ { "content": "from django.shortcuts import render_to_response\nfrom django.template import RequestContext\n\nfrom featureflipper.models import Feature\nfrom featureflipper.signals import feature_defaulted\n\n\n# We use the feature_defaulted signal to print a simple message\n# warning that a feature has been defaulted to disabled. You might\n# instead raise an exception here (to help avoid bugs in templates),\n# or add the feature to the database.\n\n\n# Uncomment the following line to enable this:\n# feature_defaulted.connect(my_callback)\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def my_callback(sender, **kwargs):\n print \"Feature '%s' defaulted!\" % kwargs['feature']", "metadata": "root.my_callback", "header": "['module', '___EOS___']", "index": 12 }, { "content": "def index(request):\n # We'll include all the features, just so we can show all the details in the page\n feature_list = Feature.objects.all()\n # Below, we'll also include the features_panel in the context.\n # 'features' will already be added to the context by the middleware.\n return render_to_response('featureflipper_example/index.html',\n {'features_panel': request.features_panel, 'feature_list': feature_list},\n context_instance=RequestContext(request))", "metadata": "root.index", "header": "['module', '___EOS___']", "index": 19 } ]
[ { "span": "from featureflipper.signals import feature_defaulted", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 52 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "shortcuts_", "import_", "render", "\\u", "to", "\\u", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Request", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "feature", "flip", "per_", "._", "models_", "import_", "Feature_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "feature", "flip", "per_", "._", "signals_", "import_", "feature", "\\u", "default", "ed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "use", " ", "the", " ", "feature", "\\u", "default", "ed", " ", "signal", " ", "to", " ", "print", " ", "a", " ", "simple", " ", "message_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "warn", "ing", " ", "tha", "t", " ", "a", " ", "feature", " ", "has", " ", "bee", "n", " ", "default", "ed", " ", "to", " ", "disable", "d", ".", " ", "You", " ", "mig", "ht_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "inst", "ead", " ", "raise", " ", "an", " ", "exception", " ", "here", " ", "(", "to", " ", "help", " ", "avoid", " ", "bug", "s", " ", "in", " ", "template", "s", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "add", " ", "the", " ", "feature", " ", "to", " ", "the", " ", "databa", "se", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Unco", "mmen", "t", " ", "the", " ", "follow", "ing", " ", "line", " ", "to", " ", "enable", " ", "this", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "feature", "\\u", "default", "ed", ".", "connect", "(", "my", "\\u", "callback", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "my", "\\u", "callback_", "(_", "sender_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Feature", " ", "'%", "s", "'", " ", "default", "ed", "!\"_", "%_", "kwargs_", "[_", "'", "feature", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "index_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", "'", "ll", " ", "include", " ", "all", " ", "the", " ", "features", ",", " ", "just", " ", "so", " ", "we", " ", "can", " ", "show", " ", "all", " ", "the", " ", "deta", "il", "s", " ", "in", " ", "the", " ", "page_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "feature", "\\u", "list_", "=_", "Feature_", "._", "objects_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Below", ",", " ", "we", "'", "ll", " ", "als", "o", " ", "include", " ", "the", " ", "features", "\\u", "panel", " ", "in", " ", "the", " ", "context", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "features", "'", " ", "will", " ", "alr", "ead", "y", " ", "be", " ", "adde", "d", " ", "to", " ", "the", " ", "context", " ", "by", " ", "the", " ", "middle", "ware", "._", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "feature", "flip", "per", "\\u", "example", "/", "index", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "features", "\\u", "panel", "'_", ":_", "request_", "._", "features", "\\u", "panel_", ",_", "'", "feature", "\\u", "list", "'_", ":_", "feature", "\\u", "list_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context", "\\u", "instance_", "=_", "Request", "Context_", "(_", "request_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
mikrosimage/OpenRenderManagement/src/octopus/dispatcher/model/node.py
[ { "content": "class BaseNode(models.Model):\n\n dispatcher = None\n\n name = models.StringField()\n parent = models.ModelField(allow_null=True)\n user = models.StringField()\n priority = models.IntegerField()\n dispatchKey = models.FloatField()\n maxRN = models.IntegerField()\n updateTime = models.FloatField()\n poolShares = PoolShareDictField()\n additionnalPoolShares = AdditionnalPoolShareDictField()\n completion = models.FloatField()\n status = models.IntegerField()\n creationTime = models.FloatField()\n startTime = models.FloatField(allow_null=True)\n updateTime = models.FloatField(allow_null=True)\n endTime = models.FloatField(allow_null=True)\n dependencies = DependencyListField()\n averageTimeByFrame = models.FloatField(allow_null=True)\n minTimeByFrame = models.FloatField(allow_null=True)\n maxTimeByFrame = models.FloatField(allow_null=True)\n timer = models.FloatField(allow_null=True)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n parent_value = property(lambda self: self._parent_value, setParentValue)\n", "metadata": "root.BaseNode", "header": "['module', '___EOS___']", "index": 41 } ]
[ { "span": "updateTime ", "start_line": 51, "start_column": 4, "end_line": 51, "end_column": 14 } ]
[ { "span": "updateTime ", "start_line": 58, "start_column": 4, "end_line": 58, "end_column": 14 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Base", "Node_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dispatcher_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "models_", "._", "String", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent_", "=_", "models_", "._", "Model", "Field_", "(_", "allow", "\\u", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "models_", "._", "String", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "priority_", "=_", "models_", "._", "Integer", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dispatch", "Key_", "=_", "models_", "._", "Float", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "RN", "_", "=_", "models_", "._", "Integer", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Time_", "=_", "models_", "._", "Float", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pool", "Share", "s_", "=_", "Poo", "l", "Share", "Dict", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addition", "nal", "Poo", "l", "Share", "s_", "=_", "Addition", "nal", "Poo", "l", "Share", "Dict", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "completion_", "=_", "models_", "._", "Float", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "models_", "._", "Integer", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "creati", "on", "Time_", "=_", "models_", "._", "Float", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "Time_", "=_", "models_", "._", "Float", "Field_", "(_", "allow", "\\u", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Time_", "=_", "models_", "._", "Float", "Field_", "(_", "allow", "\\u", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "Time_", "=_", "models_", "._", "Float", "Field_", "(_", "allow", "\\u", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dependencies_", "=_", "Dependenc", "y", "List", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "averag", "e", "Time", "By", "Frame_", "=_", "models_", "._", "Float", "Field_", "(_", "allow", "\\u", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "Time", "By", "Frame_", "=_", "models_", "._", "Float", "Field_", "(_", "allow", "\\u", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "Time", "By", "Frame_", "=_", "models_", "._", "Float", "Field_", "(_", "allow", "\\u", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "=_", "models_", "._", "Float", "Field_", "(_", "allow", "\\u", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parent", "\\u", "value_", "=_", "property_", "(_", "lambda_", "self_", ":_", "self_", "._", "\\u", "parent", "\\u", "value_", ",_", "set", "Parent", "Value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
pawl/Chinese-RFID-Access-Control-Library/examples/windows_webservice.py
[ { "content": "\[email protected]\n\tdef index(self, apiKey=None, action=None, badge=None):\n\t\tif (apiKey == \"secret\"):\n\t\t\tif badge:\n\t\t\t\tbadge = ten_digit_to_comma_format(int(badge)) \n\t\t\t\tif (action == \"remove\"):\n\t\t\t\t\ttry:\n\t\t\t\t\t\tclient.remove_user(badge)\n\t\t\t\t\t\treturn \"User Removed Successfully\"\n\t\t\t\t\texcept:\n\t\t\t\t\t\treturn \"Failed To Remove User\"\n\t\t\t\telif (action == \"add\"):\n\t\t\t\t\ttry:\n\t\t\t\t\t\tclient.add_user(badge, [1,2])\n\t\t\t\t\t\treturn \"User Added Successfully\"\n\t\t\t\t\texcept:\n\t\t\t\t\t\treturn \"Failed To Add User\"\n\t\t\t\telse:\n\t\t\t\t\treturn \"must specify an action\"\n\t\t\telse:\n\t\t\t\treturn \"no badge number entered\"\n\t\telse:\n\t\t\treturn \"\" #return nothing when no API key is entered", "metadata": "root.RootServer.index", "header": "['class', 'RootServer', ':', '___EOS___']", "index": 17 } ]
[ { "span": "except:", "start_line": 26, "start_column": 5, "end_line": 26, "end_column": 12 }, { "span": "except:", "start_line": 32, "start_column": 5, "end_line": 32, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Roo", "t", "Server_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "@_", "cherrypy_", "._", "expose_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "index_", "(_", "self_", ",_", "api", "Key_", "=_", "None_", ",_", "action_", "=_", "None_", ",_", "badge", "_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "(_", "api", "Key_", "==_", "\"", "secret", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "badge", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "badge", "_", "=_", "ten", "\\u", "digit", "\\u", "to", "\\u", "comma", "\\u", "format_", "(_", "int_", "(_", "badge", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "action_", "==_", "\"", "remove", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "client_", "._", "remove", "\\u", "user_", "(_", "badge", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "User", " ", "Remove", "d", " ", "Success", "full", "y", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "return_", "\"", "Fail", "ed", " ", "To", " ", "Remove", " ", "User", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "action_", "==_", "\"", "add", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "client_", "._", "add", "\\u", "user_", "(_", "badge", "_", ",_", "[_", "1_", ",_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "User", " ", "Added", " ", "Success", "full", "y", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "return_", "\"", "Fail", "ed", " ", "To", " ", "Add", " ", "User", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "return_", "\"", "must", " ", "speci", "fy", " ", "an", " ", "action", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "return_", "\"", "no", " ", "badge", " ", "number", " ", "enter", "ed", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDEN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 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
OrbitzWorldwide/droned/droned/lib/droned/management/dmx/__main__.py
[ { "content": "###############################################################################\n# Copyright 2006 to the present, Orbitz Worldwide, LLC.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n###############################################################################\n\n__doc__ = \"\"\"Daemon Maker eXtraordinaire - aka DMX an application wrapper\"\"\"\n__author__ = \"\"\"Justin Venus <[email protected]>\"\"\"\n\n#setup for daemonizing other processes\nif __name__ != '__main__': raise ImportError('Not importable')\nimport os\nimport sys\n \n#find out where we are on the filesystem\nDIRECTORY = os.path.abspath(os.path.dirname(__file__))\n#cool, now setup the droned/kitt lib paths\nsys.path.insert(0,os.path.abspath(os.path.join(DIRECTORY,'..','..','..')))\n\n#could probably use some lovin!!!\nunforkedPid = os.getpid()\nchildProcessPid = 0\n \nfrom twisted.internet import protocol, defer\nfrom twisted.python.log import FileLogObserver, textFromEventDict\nfrom twisted.python.util import untilConcludes\nimport signal\n \nDEFAULT_REACTORS = {\n 'Linux': 'epoll',\n 'FreeBSD': 'kqueue',\n 'SunOS': 'select',\n}\n \n#helper to get the best reactor\n \n \n \n \n \n \n \n \nenv = os.environ.copy() #copy the environment settings\nargs = tuple(sys.argv[1:]) #get all args after the original caller\n \n \n#needed for log routing\nlogdir = env.pop('DRONED_LOGDIR', os.path.join(os.path.sep, 'tmp'))\nmasksignals = bool(env.pop('DRONED_MASK_SIGNALS', True))\nclosestdin = bool(env.pop('DRONED_CLOSE_STDIN', True))\nname = env.pop('DRONED_APPLICATION', 'app')\nlabel = env.pop('DRONED_LABEL', '0')\nusetty = bool(env.pop('DRONED_USE_TTY', '0'))\npath = env.pop('DRONED_PATH', os.path.sep)\n#try to make sure the log dir is clean and organized\nif name not in logdir:\n t = os.path.join(logdir, name, label)\n try:\n if not os.path.exists(t):\n os.makedirs(t, mode=0755)\n logdir = t\n except: pass\n \n \n#we only need to fork once b/c spawn in droned took care of the second fork\nif args and os.path.exists(args[0]):\n try: os.setsid() #be a leader\n except: pass #when debugging ie (running outside of twistd) this fails\n if os.fork() == 0:\n os.chdir(os.path.sep) #be nice\n os.umask(0) #be pure\n #should go back to the original protocol\n#NOTE droned protocol will look for this on stdout\n sys.stdout.write('Daemon Pid: %d' % (os.getpid(),))\n sys.stderr.flush()\n sys.stdout.flush()\n import droned.logging\n sys.stdout = droned.logging.StdioKabob(0)\n sys.stderr = droned.logging.StdioKabob(1)\n \n maxfd = 4096 #maybe high\n try:\n import resource # Resource usage information.\n maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]\n if (maxfd == resource.RLIM_INFINITY):\n maxfd = 4096 #maybe high\n except: pass\n \n # Iterate through and close all file descriptors.\n for fd in range(0, maxfd):\n try: os.close(fd)\n except OSError: pass #ignore\n os.open(\n hasattr(os, \"devnull\") and os.devnull or \"/dev/null\",\n os.O_RDWR\n )\n os.dup2(0, 1)\n os.dup2(0, 2)\n #create logging contexts\n loggers = [\n '%s-%s_out' % (name, label),\n '%s-%s_err' % (name, label),\n ]\n #defaults for logging are pretty good\n droned.logging.logToDir(directory=logdir)\n \n #setup logging\n reactor = set_reactor()\n #preserve application logging, but mixin daily rotation\n droned.logging.logToDir(\n directory=logdir,\n LOG_TYPE=tuple(loggers),\n OBSERVER=ManagedLogger\n )\n #create our wrapper\n dmx = DaemonWrapper(reactor, name, label, args[0], args[1:], env)\n \n \n reactor.addSystemEventTrigger('before', 'shutdown', killGroup)\n reactor.callWhenRunning(dmx.running)\n reactor.run() #run until killed\n sys.exit(dmx.exitCode)\n else:\n #this is the parent that will exit to make app a daemon\n reactor = set_reactor()\n #sit and wait for the child to terminate us\n reactor.callLater(120, sys.exit, 1)\n reactor.run()\n sys.exit(0)\nsys.exit(255)\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def routeSignal(self, signum, frame):\n \"\"\"send signals we receive to the wrapped process\"\"\"\n if signum == signal.SIGTERM:\n signal.signal(signal.SIGTERM, signal.SIG_IGN)\n #make sure we get stopped\n self.reactor.callLater(120, self.reactor.stop)\n global childProcessPid\n if childProcessPid:\n self.log('Sending %s to PID: %d' % \\\n (self.SIGNALS[signum], childProcessPid)) \n try: os.kill(childProcessPid, signum)\n except:\n droned.logging.err('when sending %s to pid %d' % \\\n (self.SIGNALS[signum],childProcessPid))", "metadata": "root.DaemonWrapper.routeSignal", "header": "['class', 'DaemonWrapper', '(', 'object', ')', ':', '___EOS___']", "index": 162 } ]
[ { "span": "except: ", "start_line": 226, "start_column": 4, "end_line": 226, "end_column": 11 }, { "span": "except: ", "start_line": 232, "start_column": 4, "end_line": 232, "end_column": 11 }, { "span": "except: ", "start_line": 251, "start_column": 8, "end_line": 251, "end_column": 15 }, { "span": "except:", "start_line": 173, "start_column": 12, "end_line": 173, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Copy", "right", " ", "2006", " ", "to", " ", "the", " ", "presen", "t", ",", " ", "Orbit", "z", " ", "Wor", "ld", "wide", ",", " ", "LLC", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "doc\\u\\u_", "=_", "\"\"\"", "Da", "emo", "n", " ", "Make", "r", " ", "e", "Xtr", "ao", "rdin", "aire", " ", "-", " ", "aka", " ", "DM", "X", " ", "an", " ", "applica", "tion", " ", "wrapp", "er", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "\"\"\"", "Justi", "n", " ", "Ven", "us", " ", "<", "just", "in", ".", "ven", "us", "@", "orbit", "z", ".", "com", ">\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "setup", " ", "for", " ", "daemon", "izi", "ng", " ", "other", " ", "processes_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "!=_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "raise_", "Import", "Error_", "(_", "'", "Not", " ", "importa", "ble", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "find", " ", "out", " ", "where", " ", "we", " ", "are", " ", "on", " ", "the", " ", "filesystem_", "\\u\\u\\uNL\\u\\u\\u_", "DIRECTORY_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "cool", ",", " ", "now", " ", "setup", " ", "the", " ", "drone", "d", "/", "kitt", " ", "lib", " ", "paths_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "DIRECTORY_", ",_", "'..'_", ",_", "'..'_", ",_", "'..'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "coul", "d", " ", "probab", "ly", " ", "use", " ", "some", " ", "lo", "vin", "!!!", "_", "\\u\\u\\uNL\\u\\u\\u_", "unfo", "rke", "d", "Pid", "_", "=_", "os_", "._", "getpid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "child", "Process", "Pid", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "twisted_", "._", "internet_", "import_", "protocol_", ",_", "defer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "python_", "._", "log_", "import_", "File", "Log", "Observer_", ",_", "text", "Fro", "m", "Event", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "python_", "._", "util_", "import_", "unti", "l", "Conc", "lud", "es_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "signal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "REAC", "TOR", "S_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Lin", "ux", "'_", ":_", "'", "epo", "ll", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Free", "BS", "D", "'_", ":_", "'", "kq", "ueue", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Sun", "OS", "'_", ":_", "'", "select", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "help", "er", " ", "to", " ", "get", " ", "the", " ", "best", " ", "reactor_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "env_", "=_", "os_", "._", "environ_", "._", "copy_", "(_", ")_", "#", "copy", " ", "the", " ", "environ", "ment", " ", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "tuple_", "(_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", ")_", "#", "get", " ", "all", " ", "args", " ", "after", " ", "the", " ", "original", " ", "caller_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "need", "ed", " ", "for", " ", "log", " ", "routing_", "\\u\\u\\uNL\\u\\u\\u_", "logdir_", "=_", "env_", "._", "pop_", "(_", "'", "DR", "ONE", "D", "\\u", "LOG", "DIR", "'_", ",_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "sep_", ",_", "'", "tmp", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask", "signals_", "=_", "bool_", "(_", "env_", "._", "pop_", "(_", "'", "DR", "ONE", "D", "\\u", "MASK", "\\u", "SIGN", "ALS", "'_", ",_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "closest", "din", "_", "=_", "bool_", "(_", "env_", "._", "pop_", "(_", "'", "DR", "ONE", "D", "\\u", "CLOSE", "\\u", "STD", "IN", "'_", ",_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "env_", "._", "pop_", "(_", "'", "DR", "ONE", "D", "\\u", "APPLICATION", "'_", ",_", "'", "app", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "label_", "=_", "env_", "._", "pop_", "(_", "'", "DR", "ONE", "D", "\\u", "LAB", "EL", "'_", ",_", "'", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uset", "ty_", "=_", "bool_", "(_", "env_", "._", "pop_", "(_", "'", "DR", "ONE", "D", "\\u", "USE", "\\u", "TTY", "'_", ",_", "'", "0", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "env_", "._", "pop_", "(_", "'", "DR", "ONE", "D", "\\u", "PATH", "'_", ",_", "os_", "._", "path_", "._", "sep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "try", " ", "to", " ", "make", " ", "sure", " ", "the", " ", "log", " ", "dir", " ", "is", " ", "clean", " ", "and", " ", "organize", "d_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "name_", "not_", "in_", "logdir_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "os_", "._", "path_", "._", "join_", "(_", "logdir_", ",_", "name_", ",_", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "t_", ",_", "mode_", "=_", "0_", "755", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logdir_", "=_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "we", " ", "only", " ", "need", " ", "to", " ", "fork", " ", "onc", "e", " ", "b", "/", "c", " ", "spawn", " ", "in", " ", "drone", "d", " ", "too", "k", " ", "care", " ", "of", " ", "the", " ", "second", " ", "fork_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "and_", "os_", "._", "path_", "._", "exists_", "(_", "args_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "os_", "._", "sets", "id_", "(_", ")_", "#", "be", " ", "a", " ", "leader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "pass_", "#", "whe", "n", " ", "debugg", "ing", " ", "ie", " ", "(", "runn", "ing", " ", "outsi", "de", " ", "of", " ", "twist", "d", ")", " ", "this", " ", "fails_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "fork_", "(_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "chdir_", "(_", "os_", "._", "path_", "._", "sep_", ")_", "#", "be", " ", "nice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "umask", "_", "(_", "0_", ")_", "#", "be", " ", "pure", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "shou", "ld", " ", "go", " ", "back", " ", "to", " ", "the", " ", "original", " ", "protocol_", "\\u\\u\\uNL\\u\\u\\u_", "#", "NOTE", " ", "drone", "d", " ", "protoc", "ol", " ", "will", " ", "look", " ", "for", " ", "this", " ", "on", " ", "stdout_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "'", "Da", "emo", "n", " ", "Pid", ":", " ", "%", "d", "'_", "%_", "(_", "os_", "._", "getpid_", "(_", ")_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stderr_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "drone", "d_", "._", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "=_", "drone", "d_", "._", "logging_", "._", "Std", "io", "Ka", "bob_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stderr_", "=_", "drone", "d_", "._", "logging_", "._", "Std", "io", "Ka", "bob_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "maxf", "d_", "=_", "4096_", "#", "may", "be", " ", "high_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "resource_", "#", " ", "Reso", "urc", "e", " ", "usage", " ", "informati", "on", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "maxf", "d_", "=_", "resource_", "._", "getr", "limit_", "(_", "resource_", "._", "RL", "IM", "IT", "\\u", "NO", "FILE_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "maxf", "d_", "==_", "resource_", "._", "RL", "IM", "\\u", "INFINIT", "Y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "maxf", "d_", "=_", "4096_", "#", "may", "be", " ", "high_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Iterat", "e", " ", "through", " ", "and", " ", "close", " ", "all", " ", "file", " ", "descrip", "tors", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "fd_", "in_", "range_", "(_", "0_", ",_", "maxf", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "os_", "._", "close_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "OSE", "rror_", ":_", "pass_", "#", "ignore_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "open_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "hasattr_", "(_", "os_", ",_", "\"", "devn", "ull", "\"_", ")_", "and_", "os_", "._", "devnull_", "or_", "\"/", "dev", "/", "null", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "O", "\\u", "RD", "WR", "_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "dup", "2_", "(_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "dup", "2_", "(_", "0_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "create", " ", "logg", "ing", " ", "contexts_", "\\u\\u\\uNL\\u\\u\\u_", "loggers_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", "-%", "s", "\\u", "out", "'_", "%_", "(_", "name_", ",_", "label_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", "-%", "s", "\\u", "err", "'_", "%_", "(_", "name_", ",_", "label_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "default", "s", " ", "for", " ", "logg", "ing", " ", "are", " ", "pretty", " ", "good_", "\\u\\u\\uNL\\u\\u\\u_", "drone", "d_", "._", "logging_", "._", "log", "To", "Dir_", "(_", "directory_", "=_", "logdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "setup", " ", "logging_", "\\u\\u\\uNL\\u\\u\\u_", "reactor_", "=_", "set\\u", "reactor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "preserve", " ", "applica", "tion", " ", "logg", "ing", ",", " ", "but", " ", "mix", "in", " ", "daily", " ", "rotation_", "\\u\\u\\uNL\\u\\u\\u_", "drone", "d_", "._", "logging_", "._", "log", "To", "Dir_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "directory_", "=_", "logdir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "LOG", "\\u", "TYPE_", "=_", "tuple_", "(_", "loggers_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "OBS", "ERVE", "R_", "=_", "Manage", "d", "Logger_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "create", " ", "our", " ", "wrapper_", "\\u\\u\\uNL\\u\\u\\u_", "dm", "x_", "=_", "Da", "emo", "n", "Wrapper_", "(_", "reactor_", ",_", "name_", ",_", "label_", ",_", "args_", "[_", "0_", "]_", ",_", "args_", "[_", "1_", ":_", "]_", ",_", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "reactor_", "._", "add", "System", "Event", "Trigger_", "(_", "'", "bef", "ore", "'_", ",_", "'", "shut", "down", "'_", ",_", "kill", "Group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reactor_", "._", "call", "Whe", "n", "Running_", "(_", "dm", "x_", "._", "running_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reactor_", "._", "run_", "(_", ")_", "#", "run", " ", "unti", "l", " ", "kille", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "dm", "x_", "._", "exit", "Code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "this", " ", "is", " ", "the", " ", "parent", " ", "tha", "t", " ", "will", " ", "exit", " ", "to", " ", "make", " ", "app", " ", "a", " ", "daemon_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reactor_", "=_", "set\\u", "reactor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "sit", " ", "and", " ", "wait", " ", "for", " ", "the", " ", "child", " ", "to", " ", "terminate", " ", "us_", "\\u\\u\\uNL\\u\\u\\u_", "reactor_", "._", "call", "Later_", "(_", "120_", ",_", "sys_", "._", "exit_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reactor_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sys_", "._", "exit_", "(_", "255_", ")_", "[SEP]_", "class_", "Da", "emo", "n", "Wrapper_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "route", "Signal_", "(_", "self_", ",_", "signum_", ",_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "send", " ", "signal", "s", " ", "we", " ", "receive", " ", "to", " ", "the", " ", "wrapp", "ed", " ", "process", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "signum_", "==_", "signal_", "._", "SIGTERM_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "signal_", "._", "signal_", "(_", "signal_", "._", "SIGTERM_", ",_", "signal_", "._", "SIG", "\\u", "IGN", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "make", " ", "sure", " ", "we", " ", "get", " ", "stopped_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "reactor_", "._", "call", "Later_", "(_", "120_", ",_", "self_", "._", "reactor_", "._", "stop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "global_", "child", "Process", "Pid", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "child", "Process", "Pid", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'", "Sen", "ding", " ", "%", "s", " ", "to", " ", "PID", ":", " ", "%", "d", "'_", "%_", "(_", "self_", "._", "SIGN", "ALS", "_", "[_", "signum_", "]_", ",_", "child", "Process", "Pid", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "os_", "._", "kill_", "(_", "child", "Process", "Pid", "_", ",_", "signum_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "drone", "d_", "._", "logging_", "._", "err_", "(_", "'", "whe", "n", " ", "sendin", "g", " ", "%", "s", " ", "to", " ", "pid", " ", "%", "d", "'_", "%_", "(_", "self_", "._", "SIGN", "ALS", "_", "[_", "signum_", "]_", ",_", "child", "Process", "Pid", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unreachable code
hwaf/hwaf/py-hwaftools/find_iberty.py
[ { "content": "@conf\ndef find_iberty(ctx, **kwargs):\n \n ctx.load('hwaf-base', tooldir=_heptooldir)\n\n if not ctx.env.HWAF_FOUND_C_COMPILER:\n ctx.fatal('load a C compiler first')\n pass\n\n if not ctx.env.HWAF_FOUND_GDB:\n # gdb might have installed interesting libs (iberty, bfd)\n ctx.find_gdb(mandatory=False)\n pass\n \n extra_paths = waflib.Utils.to_list(kwargs.get('extra_paths',[]))\n if ctx.env.GDB_HOME:\n gdb = ctx.hwaf_subst_vars('${GDB_HOME}')\n extra_paths.append(gdb)\n pass\n\n # find libiberty\n ctx.check_with(\n ctx.check,\n \"iberty\",\n features='c cstlib',\n header_name=\"libiberty.h\",\n stlib='iberty',\n uselib_store='iberty',\n **kwargs\n )\n \n if ctx.env.LIBPATH_iberty and 0:\n ctx.env.STLIBPATH_iberty = ctx.env.LIBPATH_iberty\n ctx.env.STLIB_iberty = ctx.env.LIB_iberty\n ctx.env.LIB_iberty = []\n ctx.env.LIBPATH_iberty = []\n pass\n\n ctx.env.HWAF_FOUND_IBERTY = 1\n return", "metadata": "root.find_iberty", "header": "['module', '___EOS___']", "index": 24 } ]
[ { "span": "ctx.env.STLIBPATH_iberty = ctx.env.LIBPATH_iberty", "start_line": 56, "start_column": 8, "end_line": 56, "end_column": 57 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "find", "\\u", "ibe", "rty", "_", "(_", "ctx_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "load_", "(_", "'", "hwa", "f", "-", "base", "'_", ",_", "tool", "dir_", "=_", "\\u", "hep", "tool", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "ctx_", "._", "env_", "._", "HW", "AF", "\\u", "FO", "UND", "\\u", "C", "\\u", "COMPILER", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "fatal_", "(_", "'", "load", " ", "a", " ", "C", " ", "compiler", " ", "first", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "ctx_", "._", "env_", "._", "HW", "AF", "\\u", "FO", "UND", "\\u", "GD", "B_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "gdb", " ", "mig", "ht", " ", "have", " ", "install", "ed", " ", "interesting", " ", "libs", " ", "(", "ibe", "rty", ",", " ", "bf", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "find", "\\u", "gdb_", "(_", "mandatory_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "extra", "\\u", "paths_", "=_", "waf", "lib_", "._", "Utils_", "._", "to", "\\u", "list_", "(_", "kwargs_", "._", "get_", "(_", "'", "extra", "\\u", "path", "s", "'_", ",_", "[_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ctx_", "._", "env_", "._", "GD", "B", "\\u", "HOME_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gdb_", "=_", "ctx_", "._", "hwa", "f", "\\u", "subst", "\\u", "vars_", "(_", "'$", "{", "GD", "B", "\\u", "HOM", "E", "}'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "paths_", "._", "append_", "(_", "gdb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "lib", "ibe", "rty", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctx_", "._", "check", "\\u", "with_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "ctx_", "._", "check_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ibe", "rty", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "features_", "=_", "'", "c", " ", "cst", "lib", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "header", "\\u", "name_", "=_", "\"", "lib", "ibe", "rty", ".", "h", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stl", "ib_", "=_", "'", "ibe", "rty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "usel", "ib", "\\u", "store_", "=_", "'", "ibe", "rty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kwargs_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ctx_", "._", "env_", "._", "LIB", "PATH", "\\u", "ibe", "rty", "_", "and_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "env_", "._", "STL", "IB", "PATH", "\\u", "ibe", "rty", "_", "=_", "ctx_", "._", "env_", "._", "LIB", "PATH", "\\u", "ibe", "rty", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "env_", "._", "STL", "IB", "\\u", "ibe", "rty", "_", "=_", "ctx_", "._", "env_", "._", "LIB", "\\u", "ibe", "rty", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "env_", "._", "LIB", "\\u", "ibe", "rty", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "env_", "._", "LIB", "PATH", "\\u", "ibe", "rty", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctx_", "._", "env_", "._", "HW", "AF", "\\u", "FO", "UND", "\\u", "IB", "ERT", "Y_", "=_", "1_", "\\u\\u\\u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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
EricssonResearch/calvin-base/calvin/runtime/north/tests/test_storage.py
[ { "content": " def test_node_functions(self):\n self.q = Queue.Queue()\n\n def cb(key, value):\n self.q.put({\"key\": key, \"value\": value})\n\n node = TestNode(\"127.0.0.1:5000\")\n self.storage.add_node(node)\n value = self.storage.get_node(node_id=node.id, cb=CalvinCB(func=cb))\n value = self.q.get(timeout=0.2)\n assert value[\"key\"] == node.id and value[\"value\"] == {'uri': node.uri}\n\n self.storage.delete_node(node, cb=CalvinCB(func=cb))\n value = self.q.get(timeout=0.2)\n assert value\n assert node.id not in self.storage.localstore", "metadata": "root.TestStorageNotStarted.test_node_functions", "header": "['class', 'TestStorageNotStarted', '(', 'object', ')', ':', '___EOS___']", "index": 194 }, { "content": " def test_application_functions(self):\n self.q = Queue.Queue()\n\n def cb(key, value):\n self.q.put({\"key\": key, \"value\": value})\n\n application = appmanager.Application(calvinuuid.uuid(\n 'APP'), \"test_app\", [calvinuuid.uuid('ACTOR'), calvinuuid.uuid('ACTOR')])\n\n self.storage.add_application(application)\n value = self.storage.get_application(\n application.id, cb=CalvinCB(func=cb))\n value = self.q.get(timeout=0.2)\n assert value[\"key\"] == application.id and value[\n \"value\"][\"name\"] == application.name\n\n self.storage.delete_application(application.id, cb=CalvinCB(func=cb))\n value = self.q.get(timeout=0.2)\n assert value\n assert application.id not in self.storage.localstore", "metadata": "root.TestStorageNotStarted.test_application_functions", "header": "['class', 'TestStorageNotStarted', '(', 'object', ')', ':', '___EOS___']", "index": 211 }, { "content": " def test_actor_and_port_functions(self):\n self.q = Queue.Queue()\n\n def cb(key, value):\n self.q.put({\"key\": key, \"value\": value})\n\n port1 = TestPort(\"out\", \"out\")\n port2 = TestPort(\"in\", \"in\", )\n\n port1.peers = [(\"local\", port2.id)]\n port2.peer = (\"local\", port1.id)\n\n actor1 = TestActor(\"actor1\", \"type1\", {}, {port1.name: port1})\n actor2 = TestActor(\"actor2\", \"type2\", {port2.name: port2}, {})\n\n self.storage.add_actor(actor1, calvinuuid.uuid(\"NODE\"))\n value = self.storage.get_actor(actor1.id, cb=CalvinCB(func=cb))\n value = self.q.get(timeout=0.2)\n assert value[\"key\"] == actor1.id and value[\n \"value\"][\"name\"] == actor1.name\n\n assert value[\"value\"][\"name\"] == actor1.name\n assert value[\"value\"][\"type\"] == actor1._type\n assert value[\"value\"][\"inports\"] == []\n assert value[\"value\"][\"outports\"][0][\"id\"] == port1.id\n\n value = self.storage.get_port(port1.id, cb=CalvinCB(func=cb))\n value = self.q.get(timeout=0.2)\n assert value[\"key\"] == port1.id\n assert value[\"value\"][\"name\"] == port1.name\n assert value[\"value\"][\"direction\"] == port1.direction\n assert value[\"value\"][\"peers\"] == [[\"local\", port2.id]]\n\n self.storage.add_actor(actor2, calvinuuid.uuid(\"NODE\"))\n value = self.storage.get_actor(actor2.id, cb=CalvinCB(func=cb))\n value = self.q.get(timeout=0.2)\n assert value[\"key\"] == actor2.id\n assert value[\"value\"][\"name\"] == actor2.name\n assert value[\"value\"][\"type\"] == actor2._type\n assert value[\"value\"][\"inports\"][0][\"id\"] == port2.id\n assert value[\"value\"][\"outports\"] == []\n\n value = self.storage.get_port(port2.id, cb=CalvinCB(func=cb))\n value = self.q.get(timeout=0.2)\n assert value[\"key\"] == port2.id\n assert value[\"value\"][\"name\"] == port2.name\n assert value[\"value\"][\"direction\"] == port2.direction\n assert value[\"value\"][\"peer\"] == [\"local\", port1.id]\n\n self.storage.delete_actor(actor1.id, cb=CalvinCB(func=cb))\n value = self.q.get(timeout=0.2)\n assert value\n assert actor1.id not in self.storage.localstore\n\n self.storage.delete_port(port1.id, cb=CalvinCB(func=cb))\n value = self.q.get(timeout=0.2)\n assert value\n assert port1.id not in self.storage.localstore", "metadata": "root.TestStorageNotStarted.test_actor_and_port_functions", "header": "['class', 'TestStorageNotStarted', '(', 'object', ')', ':', '___EOS___']", "index": 232 } ]
[ { "span": "value ", "start_line": 202, "start_column": 8, "end_line": 202, "end_column": 13 }, { "span": "value ", "start_line": 221, "start_column": 8, "end_line": 221, "end_column": 13 }, { "span": "value ", "start_line": 248, "start_column": 8, "end_line": 248, "end_column": 13 }, { "span": "value ", "start_line": 258, "start_column": 8, "end_line": 258, "end_column": 13 }, { "span": "value ", "start_line": 266, "start_column": 8, "end_line": 266, "end_column": 13 }, { "span": "value ", "start_line": 274, "start_column": 8, "end_line": 274, "end_column": 13 } ]
[ { "span": "value ", "start_line": 203, "start_column": 8, "end_line": 203, "end_column": 13 }, { "span": "value ", "start_line": 223, "start_column": 8, "end_line": 223, "end_column": 13 }, { "span": "value ", "start_line": 249, "start_column": 8, "end_line": 249, "end_column": 13 }, { "span": "value ", "start_line": 259, "start_column": 8, "end_line": 259, "end_column": 13 }, { "span": "value ", "start_line": 267, "start_column": 8, "end_line": 267, "end_column": 13 }, { "span": "value ", "start_line": 275, "start_column": 8, "end_line": 275, "end_column": 13 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "Stor", "age", "Not", "Started_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "node", "\\u", "functions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "q_", "=_", "Queue_", "._", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "cb_", "(_", "key_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "q_", "._", "put_", "(_", "{_", "\"", "key", "\"_", ":_", "key_", ",_", "\"", "value", "\"_", ":_", "value_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node_", "=_", "Test", "Node_", "(_", "\"", "127", ".0", ".0", ".1", ":", "5000", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "storage_", "._", "add", "\\u", "node_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "self_", "._", "storage_", "._", "get", "\\u", "node_", "(_", "node", "\\u", "id_", "=_", "node_", "._", "id_", ",_", "cb_", "=_", "Cal", "vin", "CB_", "(_", "func_", "=_", "cb_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "self_", "._", "q_", "._", "get_", "(_", "timeout_", "=_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "value_", "[_", "\"", "key", "\"_", "]_", "==_", "node_", "._", "id_", "and_", "value_", "[_", "\"", "value", "\"_", "]_", "==_", "{_", "'", "uri", "'_", ":_", "node_", "._", "uri_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "storage_", "._", "delete", "\\u", "node_", "(_", "node_", ",_", "cb_", "=_", "Cal", "vin", "CB_", "(_", "func_", "=_", "cb_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "self_", "._", "q_", "._", "get_", "(_", "timeout_", "=_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "node_", "._", "id_", "not_", "in_", "self_", "._", "storage_", "._", "locals", "tore_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Stor", "age", "Not", "Started_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "applica", "tion", "\\u", "functions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "q_", "=_", "Queue_", "._", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "cb_", "(_", "key_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "q_", "._", "put_", "(_", "{_", "\"", "key", "\"_", ":_", "key_", ",_", "\"", "value", "\"_", ":_", "value_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "application_", "=_", "app", "manager_", "._", "Application_", "(_", "cal", "vin", "uuid_", "._", "uuid_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "APP", "'_", ")_", ",_", "\"", "test\\u", "app", "\"_", ",_", "[_", "cal", "vin", "uuid_", "._", "uuid_", "(_", "'", "ACT", "OR", "'_", ")_", ",_", "cal", "vin", "uuid_", "._", "uuid_", "(_", "'", "ACT", "OR", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "storage_", "._", "add", "\\u", "application_", "(_", "application_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "self_", "._", "storage_", "._", "get", "\\u", "application_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "application_", "._", "id_", ",_", "cb_", "=_", "Cal", "vin", "CB_", "(_", "func_", "=_", "cb_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "self_", "._", "q_", "._", "get_", "(_", "timeout_", "=_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "value_", "[_", "\"", "key", "\"_", "]_", "==_", "application_", "._", "id_", "and_", "value_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "value", "\"_", "]_", "[_", "\"", "name", "\"_", "]_", "==_", "application_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "storage_", "._", "delete", "\\u", "application_", "(_", "application_", "._", "id_", ",_", "cb_", "=_", "Cal", "vin", "CB_", "(_", "func_", "=_", "cb_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "self_", "._", "q_", "._", "get_", "(_", "timeout_", "=_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "application_", "._", "id_", "not_", "in_", "self_", "._", "storage_", "._", "locals", "tore_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Stor", "age", "Not", "Started_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "actor", "\\u", "and", "\\u", "port", "\\u", "functions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "q_", "=_", "Queue_", "._", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "cb_", "(_", "key_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "q_", "._", "put_", "(_", "{_", "\"", "key", "\"_", ":_", "key_", ",_", "\"", "value", "\"_", ":_", "value_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "port", "1_", "=_", "Test", "Port_", "(_", "\"", "out", "\"_", ",_", "\"", "out", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port", "2_", "=_", "Test", "Port_", "(_", "\"", "in", "\"_", ",_", "\"", "in", "\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "port", "1_", "._", "peers_", "=_", "[_", "(_", "\"", "local", "\"_", ",_", "port", "2_", "._", "id_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port", "2_", "._", "peer_", "=_", "(_", "\"", "local", "\"_", ",_", "port", "1_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actor", "1_", "=_", "Test", "Actor_", "(_", "\"", "actor", "1", "\"_", ",_", "\"", "type", "1", "\"_", ",_", "{_", "}_", ",_", "{_", "port", "1_", "._", "name_", ":_", "port", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actor", "2_", "=_", "Test", "Actor_", "(_", "\"", "actor", "2", "\"_", ",_", "\"", "type", "2", "\"_", ",_", "{_", "port", "2_", "._", "name_", ":_", "port", "2_", "}_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "storage_", "._", "add", "\\u", "actor_", "(_", "actor", "1_", ",_", "cal", "vin", "uuid_", "._", "uuid_", "(_", "\"", "NODE", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "self_", "._", "storage_", "._", "get", "\\u", "actor_", "(_", "actor", "1_", "._", "id_", ",_", "cb_", "=_", "Cal", "vin", "CB_", "(_", "func_", "=_", "cb_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "self_", "._", "q_", "._", "get_", "(_", "timeout_", "=_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "value_", "[_", "\"", "key", "\"_", "]_", "==_", "actor", "1_", "._", "id_", "and_", "value_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "value", "\"_", "]_", "[_", "\"", "name", "\"_", "]_", "==_", "actor", "1_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "value_", "[_", "\"", "value", "\"_", "]_", "[_", "\"", "name", "\"_", "]_", "==_", "actor", "1_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "value_", "[_", "\"", "value", "\"_", "]_", "[_", "\"", "type", "\"_", "]_", "==_", "actor", "1_", "._", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "value_", "[_", "\"", "value", "\"_", "]_", "[_", "\"", "inp", "orts", "\"_", "]_", "==_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "value_", "[_", "\"", "value", "\"_", "]_", "[_", "\"", "outp", "orts", "\"_", "]_", "[_", "0_", "]_", "[_", "\"", "id", "\"_", "]_", "==_", "port", "1_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "self_", "._", "storage_", "._", "get", "\\u", "port_", "(_", "port", "1_", "._", "id_", ",_", "cb_", "=_", "Cal", "vin", "CB_", "(_", "func_", "=_", "cb_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "self_", "._", "q_", "._", "get_", "(_", "timeout_", "=_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "value_", "[_", "\"", "key", "\"_", "]_", "==_", "port", "1_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "value_", "[_", "\"", "value", "\"_", "]_", "[_", "\"", "name", "\"_", "]_", "==_", "port", "1_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "value_", "[_", "\"", "value", "\"_", "]_", "[_", "\"", "direction", "\"_", "]_", "==_", "port", "1_", "._", "direction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "value_", "[_", "\"", "value", "\"_", "]_", "[_", "\"", "peer", "s", "\"_", "]_", "==_", "[_", "[_", "\"", "local", "\"_", ",_", "port", "2_", "._", "id_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "storage_", "._", "add", "\\u", "actor_", "(_", "actor", "2_", ",_", "cal", "vin", "uuid_", "._", "uuid_", "(_", "\"", "NODE", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "self_", "._", "storage_", "._", "get", "\\u", "actor_", "(_", "actor", "2_", "._", "id_", ",_", "cb_", "=_", "Cal", "vin", "CB_", "(_", "func_", "=_", "cb_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "self_", "._", "q_", "._", "get_", "(_", "timeout_", "=_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "value_", "[_", "\"", "key", "\"_", "]_", "==_", "actor", "2_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "value_", "[_", "\"", "value", "\"_", "]_", "[_", "\"", "name", "\"_", "]_", "==_", "actor", "2_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "value_", "[_", "\"", "value", "\"_", "]_", "[_", "\"", "type", "\"_", "]_", "==_", "actor", "2_", "._", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "value_", "[_", "\"", "value", "\"_", "]_", "[_", "\"", "inp", "orts", "\"_", "]_", "[_", "0_", "]_", "[_", "\"", "id", "\"_", "]_", "==_", "port", "2_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "value_", "[_", "\"", "value", "\"_", "]_", "[_", "\"", "outp", "orts", "\"_", "]_", "==_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "self_", "._", "storage_", "._", "get", "\\u", "port_", "(_", "port", "2_", "._", "id_", ",_", "cb_", "=_", "Cal", "vin", "CB_", "(_", "func_", "=_", "cb_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "self_", "._", "q_", "._", "get_", "(_", "timeout_", "=_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "value_", "[_", "\"", "key", "\"_", "]_", "==_", "port", "2_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "value_", "[_", "\"", "value", "\"_", "]_", "[_", "\"", "name", "\"_", "]_", "==_", "port", "2_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "value_", "[_", "\"", "value", "\"_", "]_", "[_", "\"", "direction", "\"_", "]_", "==_", "port", "2_", "._", "direction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "value_", "[_", "\"", "value", "\"_", "]_", "[_", "\"", "peer", "\"_", "]_", "==_", "[_", "\"", "local", "\"_", ",_", "port", "1_", "._", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "storage_", "._", "delete", "\\u", "actor_", "(_", "actor", "1_", "._", "id_", ",_", "cb_", "=_", "Cal", "vin", "CB_", "(_", "func_", "=_", "cb_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "self_", "._", "q_", "._", "get_", "(_", "timeout_", "=_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "actor", "1_", "._", "id_", "not_", "in_", "self_", "._", "storage_", "._", "locals", "tore_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "storage_", "._", "delete", "\\u", "port_", "(_", "port", "1_", "._", "id_", ",_", "cb_", "=_", "Cal", "vin", "CB_", "(_", "func_", "=_", "cb_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "self_", "._", "q_", "._", "get_", "(_", "timeout_", "=_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "port", "1_", "._", "id_", "not_", "in_", "self_", "._", "storage_", "._", "locals", "tore_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
azoft-dev-team/imagrium/env/Lib/xml/sax/drivers2/drv_javasax.py
[ { "content": " def comment(self, char, start, len):\n try:\n # Need to wrap this in a try..except in case the parser does not support lexical events\n self._cont_handler.comment(unicode(String(char, start, len)))\n except:\n pass", "metadata": "root.JavaSAXParser.comment", "header": "['class', 'JavaSAXParser', '(', 'xmlreader', '.', 'XMLReader', ',', 'javasax', '.', 'ContentHandler', ',', 'LexicalHandler', ')', ':', '___EOS___']", "index": 214 } ]
[ { "span": "except:", "start_line": 218, "start_column": 8, "end_line": 218, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Ja", "va", "SA", "XP", "arser", "_", "(_", "xml", "reader_", "._", "XML", "Reader_", ",_", "java", "sax_", "._", "Conten", "t", "Handler_", ",_", "Lexi", "cal", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "comment_", "(_", "self_", ",_", "char_", ",_", "start_", ",_", "len_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ne", "ed", " ", "to", " ", "wrap", " ", "this", " ", "in", " ", "a", " ", "try", "..", "except", " ", "in", " ", "case", " ", "the", " ", "parser", " ", "doe", "s", " ", "not", " ", "support", " ", "lexica", "l", " ", "events_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "cont", "\\u", "handler_", "._", "comment_", "(_", "unicode_", "(_", "String_", "(_", "char_", ",_", "start_", ",_", "len_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2 ]
Unused import
yyuu/botornado/setup.py
[ { "content": "#!/usr/bin/env python\n\nfrom __future__ import with_statement\nimport contextlib\nimport re\n\ntry:\n from setuptools import setup, find_packages\nexcept ImportError:\n from ez_setup import use_setuptools\n use_setuptools()\n from setuptools import setup, find_packages\n\nsetup(\n name='botornado',\n version='0.0.5git',\n description='boto on tornado - an asynchronous Amazon Web Service (AWS) client',\n author='Yamashita, Yuu',\n author_email='[email protected]',\n url='https://github.com/yyuu/botornado',\n install_requires=[\n# \"boto==2.2.2\", # current version of botornado includes tested version of boto in source tree\n \"tornado>=2.1.1\",\n ],\n packages=find_packages(),\n test_suite='botornado.test',\n license='MIT',\n platforms=\"Posix; MacOS X; Windows\",\n classifiers=[\n \"Development Status :: 3 - Alpha\",\n \"Environment :: Web Environment\",\n \"Intended Audience :: Developers\",\n \"License :: OSI Approved :: MIT License\",\n \"Operating System :: OS Independent\",\n \"Topic :: Internet\"\n ],\n)\n\n# vim:set ft=python sw=4 :\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import contextlib", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 17 }, { "span": "import re", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 9 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "with", "\\u", "statement_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "contextlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "setuptools_", "import_", "setup_", ",_", "find", "\\u", "packages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "ez", "\\u", "setup_", "import_", "use", "\\u", "setuptools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "setuptools_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "setuptools_", "import_", "setup_", ",_", "find", "\\u", "packages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "boto", "rna", "do", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "'", "0.", "0.", "5", "git", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "'", "boto", " ", "on", " ", "torn", "ado", " ", "-", " ", "an", " ", "async", "hronous", " ", "Ama", "zon", " ", "Web", " ", "Service", " ", "(", "AW", "S", ")", " ", "client", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "'", "Ya", "mas", "hit", "a", ",", " ", "Yu", "u", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "'", "peek", "824", "545", "201", "@", "gma", "il", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "https", "://", "git", "hub", ".", "com", "/", "yy", "uu", "/", "boto", "rna", "do", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "requires_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "\"", "boto", "==", "2.2", ".2", "\",", " ", "#", " ", "current", " ", "version", " ", "of", " ", "boto", "rna", "do", " ", "include", "s", " ", "tested", " ", "version", " ", "of", " ", "boto", " ", "in", " ", "source", " ", "tree_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "torn", "ado", ">=", "2.1", ".1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "find", "\\u", "packages_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "suite_", "=_", "'", "boto", "rna", "do", ".", "test", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "license_", "=_", "'", "MIT", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "platforms_", "=_", "\"", "Posi", "x", ";", " ", "Mac", "OS", " ", "X", ";", " ", "Window", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "classifiers_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Dev", "elo", "pme", "nt", " ", "Status", " ", "::", " ", "3", " ", "-", " ", "Al", "pha", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Environ", "ment", " ", "::", " ", "Web", " ", "Environ", "ment", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Inten", "ded", " ", "Audi", "ence", " ", "::", " ", "Dev", "elope", "rs", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "License", " ", "::", " ", "OSI", " ", "Appro", "ved", " ", "::", " ", "MIT", " ", "License", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Opera", "ting", " ", "System", " ", "::", " ", "OS", " ", "Inde", "pend", "ent", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Topic", " ", "::", " ", "Intern", "et", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "vim", ":", "set", " ", "ft", "=", "python", " ", "sw", "=", "4", " ", ":_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
rizar/attention-lvcsr/libs/Theano/theano/sparse/sandbox/test_sp.py
[ { "content": "from nose.plugins.skip import SkipTest\nimport sys\nimport time\nimport unittest\n\nimport theano.sparse\nif not theano.sparse.enable_sparse:\n raise SkipTest('Optional package sparse disabled')\n\nimport scipy.sparse\nfrom scipy.signal import convolve2d\nimport scipy.sparse as sparse\nimport numpy\nfrom six.moves import xrange\n\nfrom theano import function, tensor\nimport theano\nfrom theano.compat import next\nfrom theano.sparse.sandbox import sp\nfrom theano.sparse.tests.test_basic import random_lil\nfrom theano.tests import unittest_tools as utt\nfrom theano.sparse import verify_grad_sparse\nfrom theano.sparse.tests.test_basic import sparse_random_inputs\nfrom theano.tests.unittest_tools import attr\n\n\n\n\nif __name__ == '__main__':\n if 0:\n test_remove0()\n exit()\n if 1:\n testcase = TestSP\n suite = unittest.TestLoader()\n suite = suite.loadTestsFromTestCase(testcase)\n unittest.TextTestRunner(verbosity=2).run(suite)\n else:\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestSP(unittest.TestCase):\n\n\n# print '**** Convolution Profiling Results (',mode,') ****'\n# print 'Numpy processing time: ', ntot\n# print 'Theano processing time: ', ttot\n\n # profmode.print_summary()\n\n\n# print '**** Sparse Profiling Results (',mode,') ****'\n# print 'Numpy processing time: ', ntot\n# print 'Theano processing time: ', ttot\n # profmode.print_summary()\n\n\n # this doesn't compare the output of anything... but I manually verified that the patches\n # are properly generated\n\n", "metadata": "root.TestSP", "header": "['module', '___EOS___']", "index": 26 }, { "content": " @attr('slow')\n def test_convolution(self):\n# print '\\n\\n*************************************************'\n# print ' TEST CONVOLUTION'\n# print '*************************************************'\n\n # fixed parameters\n bsize = 10 # batch size\n imshp = (28, 28)\n kshp = (5, 5)\n nkern = 5\n ssizes = ((1, 1), (2, 2), (3, 3), (4, 4))\n convmodes = ('full', 'valid')\n\n # symbolic stuff\n bias = tensor.dvector()\n kerns = tensor.dmatrix()\n input = tensor.dmatrix()\n rng = numpy.random.RandomState(3423489)\n filters = rng.randn(nkern, numpy.prod(kshp))\n biasvals = rng.randn(nkern)\n\n for mode in ('FAST_COMPILE', 'FAST_RUN'): # , profmode):\n ttot, ntot = 0, 0\n for conv_mode in convmodes:\n for ss in ssizes:\n\n output, outshp = sp.convolve(kerns, kshp, nkern, input,\\\n imshp, ss, bias=bias, mode=conv_mode)\n f = function([kerns, bias, input], output, mode=mode)\n\n # now test with real values\n img2d = numpy.arange(bsize * numpy.prod(imshp)).reshape(( \\\n bsize,) + imshp)\n img1d = img2d.reshape(bsize, -1)\n\n # create filters (need to be flipped to use convolve2d)\n filtersflipped = numpy.zeros((nkern,) + kshp)\n for k in range(nkern):\n it = reversed(filters[k, :])\n for i in range(kshp[0]):\n for j in range(kshp[1]):\n filtersflipped[k, i, j] = next(it)\n\n # compute output with convolve2d\n if conv_mode == 'valid':\n fulloutshp = numpy.array(imshp) - numpy.array(kshp) + 1\n else:\n fulloutshp = numpy.array(imshp) + numpy.array(kshp) - 1\n ntime1 = time.time()\n refout = numpy.zeros((bsize,)+tuple(fulloutshp)+(nkern,))\n for b in range(bsize):\n for n in range(nkern):\n refout[b, ..., n] = convolve2d(img2d[b, :, :],\n filtersflipped[n, ...],\n conv_mode)\n ntot += time.time() - ntime1\n\n # need to flatten images\n bench1 = refout[:, 0::ss[0], 0::ss[1], :].reshape(bsize, -1, nkern)\n bench1 += biasvals.reshape(1, 1, nkern)\n\n # swap the last two dimensions (output needs to be nkern x outshp)\n bench1 = numpy.swapaxes(bench1, 1, 2)\n ttime1 = time.time()\n out1 = f(filters, biasvals, img1d)\n ttot += time.time() - ttime1\n temp = bench1.flatten() - out1.flatten()\n\n assert (temp < 1e-5).all()\n\n # test downward propagation -- symbolic stuff\n #vis = tensor.grad(output, input, output)\n #downprop = function([kerns,input], vis, mode=mode)\n #visval = downprop(filters,img1d)\n # test downward propagation -- reference implementation\n #pshape = (img1d.shape[0],numpy.prod(outshp[1:]),numpy.prod(kshp))\n #patchstack = numpy.zeros(pshape)\n # for bi in numpy.arange(pshape[0]): # batch index\n #abspos = 0\n # for outy in numpy.arange(outshp[1]):\n # for outx in numpy.arange(outshp[2]):\n # for ni in numpy.arange(nkern):\n # print 'filters[n,:].shape = ', filters[n,:].shape\n # print 'out1[bi,abspos].shape =',out1[bi,abspos].shape\n #patchstack[bi,abspos,:] = filters[n,:]*out1[bi,abspos]\n # abspos+=1\n #patchstack = patchstack.reshape(1,-1)\n # indices, indptr, spmat_shape, sptype, outshp = \\\n # sp.convolution_indices.conv_eval(imshp,kshp,ss,conv_mode)\n #spmat = sparse.csc_matrix((numpy.ones_like(indices),indices,indptr),spmat_shape)\n #visref = numpy.dot(patchstack, spmat.todense())\n\n # print 'visval = ', visval\n # print 'visref = ', visref\n\n #assert numpy.all(visref==visval)", "metadata": "root.TestSP.test_convolution", "header": "['class', 'TestSP', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 27 }, { "content": " @attr('slow')\n def test_sparse(self):\n\n# print '\\n\\n*************************************************'\n# print ' TEST SPARSE'\n# print '*************************************************'\n\n # fixed parameters\n bsize = 10 # batch size\n imshp = (8, 8)\n kshp = (5, 5)\n nkern = 1 # per output pixel\n ssizes = ((1, 1), (2, 2))\n convmodes = ('full', 'valid',)\n\n # symbolic stuff\n bias = tensor.dvector()\n kerns = tensor.dvector()\n input = tensor.dmatrix()\n rng = numpy.random.RandomState(3423489)\n\n import theano.gof as gof\n\n for mode in (None,):\n ntot, ttot = 0, 0\n for conv_mode in convmodes:\n for ss in ssizes:\n\n output, outshp = sp.applySparseFilter(kerns, kshp,\\\n nkern, input, imshp, ss, bias=bias, mode=conv_mode)\n f = function([kerns, bias, input], output, mode=mode)\n\n # build actual input images\n img2d = numpy.arange(bsize*numpy.prod(imshp)).reshape((bsize,)+imshp)\n img1d = img2d.reshape(bsize, -1)\n zeropad_img = numpy.zeros((bsize,\\\n img2d.shape[1]+2*(kshp[0]-1),\\\n img2d.shape[2]+2*(kshp[1]-1)))\n zeropad_img[:, kshp[0]-1:kshp[0]-1+img2d.shape[1],\n kshp[1]-1:kshp[1]-1+img2d.shape[2]] = img2d\n\n # build kernel matrix -- flatten it for theano stuff\n filters = numpy.arange(numpy.prod(outshp)*numpy.prod(kshp)).\\\n reshape(nkern, numpy.prod(outshp[1:]), numpy.prod(kshp))\n spfilt = filters.flatten()\n biasvals = numpy.arange(numpy.prod(outshp))\n\n # compute output by hand\n ntime1 = time.time()\n refout = numpy.zeros((bsize, nkern, outshp[1], outshp[2]))\n patch = numpy.zeros((kshp[0], kshp[1]))\n for b in xrange(bsize):\n for k in xrange(nkern):\n pixi = 0 # pixel index in raster order\n for j in xrange(outshp[1]):\n for i in xrange(outshp[2]):\n n = j * ss[0]\n m = i * ss[1]\n patch = zeropad_img[b, n:n+kshp[0], m:m+kshp[1]]\n refout[b, k, j, i] = numpy.dot(filters[k, pixi, :],\\\n patch.flatten())\n pixi += 1\n refout = refout.reshape(bsize, -1) + biasvals\n ntot += time.time() - ntime1\n\n # need to flatten images\n ttime1 = time.time()\n out1 = f(spfilt, biasvals, img1d)\n ttot += time.time() - ttime1\n\n temp = refout - out1\n assert (temp < 1e-10).all()\n\n # test downward propagation\n vis = tensor.grad(0.5*tensor.sqr(output).sum(), input)\n downprop = function([kerns, output], vis)\n temp1 = time.time()\n for zz in range(100):\n visval = downprop(spfilt, out1)\n indices, indptr, spmat_shape, sptype, outshp, kmap = \\\n sp.convolution_indices.sparse_eval(imshp, kshp, nkern, ss, conv_mode)\n spmat = sparse.csc_matrix((spfilt[kmap], indices, indptr), spmat_shape)\n visref = numpy.dot(out1, spmat.todense())\n assert numpy.all(visref == visval), (visref, visval)", "metadata": "root.TestSP.test_sparse", "header": "['class', 'TestSP', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 132 }, { "content": " @attr('slow')\n def test_multilayer_sparse(self):\n # fixed parameters\n bsize = 10 # batch size\n imshp = (5, 5)\n kshp = ((3, 3), (2, 2))\n nkerns = (10, 20) # per output pixel\n ssizes = ((1, 1), (2, 2))\n convmodes = ('full', 'valid',)\n\n # symbolic stuff\n kerns = [tensor.dvector(), tensor.dvector()]\n input = tensor.dmatrix()\n rng = numpy.random.RandomState(3423489)\n\n # build actual input images\n img2d = numpy.arange(bsize*numpy.prod(imshp)).reshape((bsize,)+imshp)\n img1d = img2d.reshape(bsize, -1)\n\n for mode in ('FAST_COMPILE', 'FAST_RUN'):\n for conv_mode in convmodes:\n for ss in ssizes:\n\n l1hid, l1outshp = sp.applySparseFilter(kerns[0], kshp[0],\\\n nkerns[0], input, imshp, ss, mode=conv_mode)\n l2hid, l2outshp = sp.applySparseFilter(kerns[1], kshp[1],\\\n nkerns[1], l1hid, l1outshp, ss, mode=conv_mode)\n\n l1propup = function([kerns[0], input], l1hid, mode=mode)\n l2propup = function([kerns[1], l1hid], l2hid, mode=mode)\n\n # actual values\n l1kernvals = numpy.arange(numpy.prod(l1outshp)*numpy.prod(kshp[0]))\n l2kernvals = numpy.arange(numpy.prod(l2outshp)*numpy.prod(kshp[1])*nkerns[0])\n l1hidval = l1propup(l1kernvals, img1d)\n l2hidval = l2propup(l2kernvals, l1hidval)", "metadata": "root.TestSP.test_multilayer_sparse", "header": "['class', 'TestSP', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 222 }, { "content": " def test_multilayer_conv(self):\n # fixed parameters\n bsize = 10 # batch size\n imshp = (5, 5)\n kshp = ((3, 3), (2, 2))\n nkerns = (3, 6) # per output pixel\n ssizes = (((1, 1), (2, 2)),)\n convmodes = ('full',) # 'valid',)\n\n # symbolic stuff\n kerns = [tensor.dmatrix(), tensor.dmatrix()]\n input = tensor.dmatrix()\n rng = numpy.random.RandomState(3423489)\n\n # build actual input images\n img2d = numpy.arange(bsize*numpy.prod(imshp)).reshape((bsize,)+imshp)\n img1d = img2d.reshape(bsize, -1)\n\n for mode in ('FAST_COMPILE', 'FAST_RUN'):\n for conv_mode in convmodes:\n for ss in ssizes:\n\n l1hid, l1shp = sp.convolve(kerns[0], kshp[0],\\\n nkerns[0], input, imshp, ss[0], mode=conv_mode)\n l1propup = function([kerns[0], input], l1hid, mode=mode)\n\n #l1kernvals = numpy.random.rand(nkerns[0],numpy.prod(kshp[0]))\n l1kernvals = numpy.arange(nkerns[0]*numpy.prod(kshp[0])).reshape(nkerns[0], numpy.prod(kshp[0]))\n l1hidval = l1propup(l1kernvals, img1d)\n\n # actual values\n l2hid, l2shp = sp.convolve(kerns[1], kshp[1],\\\n nkerns[1], l1hid, l1shp, ss[1], mode=conv_mode)\n l2propup = function([kerns[1], l1hid], l2hid, mode=mode)\n\n #l2kernvals = numpy.random.rand(nkerns[1],numpy.prod(kshp[1])*nkerns[0])\n l2kernvals = numpy.arange(nkerns[1]*numpy.prod(kshp[1])*nkerns[0]).reshape(nkerns[1], numpy.prod(kshp[1])*nkerns[0])\n # for debugging, we bring things back to integers\n l1hidval = numpy.arange(numpy.size(l1hidval)).reshape(l1hidval.shape)\n\n l2hidval = l2propup(l2kernvals, l1hidval)", "metadata": "root.TestSP.test_multilayer_conv", "header": "['class', 'TestSP', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 261 }, { "content": " def test_maxpool(self):\n # generate flatted images\n maxpoolshps = ((2, 2), (3, 3), (4, 4), (5, 5), (6, 6))\n imval = numpy.random.rand(4, 5, 10, 10)\n\n images = tensor.dmatrix()\n for maxpoolshp in maxpoolshps:\n\n # symbolic stuff\n output, outshp = sp.max_pool(images, imval.shape[1:], maxpoolshp)\n f = function([images, ], [output, ])\n output_val = f(imval.reshape(imval.shape[0], -1))\n\n # numeric verification\n my_output_val = numpy.zeros((imval.shape[0], imval.shape[1],\n imval.shape[2] // maxpoolshp[0],\n imval.shape[3] // maxpoolshp[1]))\n assert numpy.prod(my_output_val.shape[1:]) == numpy.prod(numpy.r_[imval.shape[1], outshp])\n\n for n in range(imval.shape[0]):\n for k in range(imval.shape[1]):\n for i in range(imval.shape[2] // maxpoolshp[0]):\n for j in range(imval.shape[3] // maxpoolshp[1]):\n ii, jj = i*maxpoolshp[0], j*maxpoolshp[1]\n patch = imval[n, k, ii:ii+maxpoolshp[0], jj:jj+maxpoolshp[1]]\n my_output_val[n, k, i, j] = numpy.max(patch)\n my_output_val = my_output_val.reshape(imval.shape[0], -1)\n assert numpy.all(output_val == my_output_val)\n\n def mp(input):\n output, outshp = sp.max_pool(input, imval.shape[1:], maxpoolshp)\n return output\n utt.verify_grad(mp, [imval.reshape(imval.shape[0], -1)])", "metadata": "root.TestSP.test_maxpool", "header": "['class', 'TestSP', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 303 }, { "content": " def test_CSMGrad(self):\n imshp = (3, 3)\n nkern = 1 # per output pixel\n kshp = (2, 2)\n #ssizes = ((1,1),(2,2))\n ssizes = ((1, 1),)\n #convmodes = ('full','valid',)\n convmodes = ('full',)\n\n kerns = tensor.dvector()\n indices = tensor.ivector()\n indptr = tensor.ivector()\n spmat_shape = tensor.ivector()\n\n for mode in ['FAST_COMPILE', 'FAST_RUN']:\n for conv_mode in convmodes:\n for ss in ssizes:\n indvals, indptrvals, spshapevals, sptype, outshp, kmap = \\\n sp.convolution_indices.sparse_eval(imshp, kshp, nkern, ss, conv_mode)\n kvals = numpy.random.random(nkern*numpy.prod(kshp)*numpy.prod(outshp)).flatten()\n\n def d(kerns):\n return theano.sparse.dense_from_sparse(\n theano.sparse.CSM(sptype, kmap)(\n kerns, indvals, indptrvals, spshapevals))\n\n # symbolic stuff\n utt.verify_grad(d, [kvals])", "metadata": "root.TestSP.test_CSMGrad", "header": "['class', 'TestSP', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 337 } ]
[ { "span": "import sys", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 10 }, { "span": "import scipy.sparse", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 19 }, { "span": "from theano.sparse.tests.test_basic import random_lil", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 53 }, { "span": "from theano.sparse import verify_grad_sparse", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 44 }, { "span": "from theano.sparse.tests.test_basic import sparse_random_inputs", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 63 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "nose_", "._", "plugins_", "._", "skip_", "import_", "Ski", "p", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "theano_", "._", "sparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "theano_", "._", "sparse_", "._", "enable", "\\u", "sparse_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ski", "p", "Test_", "(_", "'", "Optio", "nal", " ", "package", " ", "spars", "e", " ", "disable", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "scipy_", "._", "sparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scipy_", "._", "signal_", "import_", "convolve", "2d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "scipy_", "._", "sparse_", "as_", "sparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "six_", "._", "moves_", "import_", "xrange_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "theano_", "import_", "function_", ",_", "tensor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "theano_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "theano_", "._", "compat_", "import_", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "theano_", "._", "sparse_", "._", "sandbox_", "import_", "sp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "theano_", "._", "sparse_", "._", "tests_", "._", "test\\u", "basic_", "import_", "random", "\\u", "lil", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "theano_", "._", "tests_", "import_", "unittest", "\\u", "tools_", "as_", "utt", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "theano_", "._", "sparse_", "import_", "verify", "\\u", "grad", "\\u", "sparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "theano_", "._", "sparse_", "._", "tests_", "._", "test\\u", "basic_", "import_", "spars", "e\\u", "random", "\\u", "inputs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "theano_", "._", "tests_", "._", "unittest", "\\u", "tools_", "import_", "attr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "remove", "0_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "testcase_", "=_", "Test", "SP_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suite_", "=_", "unittest_", "._", "Test", "Loader_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suite_", "=_", "suite_", "._", "load", "Test", "s", "Fro", "m", "Test", "Case_", "(_", "testcase_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unittest_", "._", "Text", "Test", "Runner_", "(_", "verbosity_", "=_", "2_", ")_", "._", "run_", "(_", "suite_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "SP_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "'**", "**", " ", "Convolution", " ", "Profil", "ing", " ", "Result", "s", " ", "('", ",", "mode", ",'", ")", " ", "****", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "'", "Num", "py", " ", "process", "ing", " ", "time", ":", " ", "',", " ", "nto", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "'", "The", "ano", " ", "process", "ing", " ", "time", ":", " ", "',", " ", "tto", "t_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "prof", "mode", ".", "print", "\\u", "summar", "y", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "'**", "**", " ", "Spar", "se", " ", "Profil", "ing", " ", "Result", "s", " ", "('", ",", "mode", ",'", ")", " ", "****", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "'", "Num", "py", " ", "process", "ing", " ", "time", ":", " ", "',", " ", "nto", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "'", "The", "ano", " ", "process", "ing", " ", "time", ":", " ", "',", " ", "tto", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "prof", "mode", ".", "print", "\\u", "summar", "y", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "doe", "sn", "'", "t", " ", "compare", " ", "the", " ", "output", " ", "of", " ", "anyt", "hing", "...", " ", "but", " ", "I", " ", "manu", "ally", " ", "verifie", "d", " ", "tha", "t", " ", "the", " ", "patches_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "proper", "ly", " ", "generated_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "SP_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "attr_", "(_", "'", "slow", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "convolution", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "'\\\\", "n", "\\\\", "n", "***********", "***********", "***********", "***********", "*****", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "'", " ", " ", " ", "TEST", " ", "CONV", "OLUT", "ION", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "'*******", "***********", "***********", "***********", "********", "*'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fixed", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bsi", "ze_", "=_", "10_", "#", " ", "batch", " ", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ims", "hp_", "=_", "(_", "28_", ",_", "28_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ksh", "p_", "=_", "(_", "5_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nke", "rn_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssi", "zes", "_", "=_", "(_", "(_", "1_", ",_", "1_", ")_", ",_", "(_", "2_", ",_", "2_", ")_", ",_", "(_", "3_", ",_", "3_", ")_", ",_", "(_", "4_", ",_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conv", "modes_", "=_", "(_", "'", "full", "'_", ",_", "'", "valid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "symbolic", " ", "stuff_", "\\u\\u\\uNL\\u\\u\\u_", "bias_", "=_", "tensor_", "._", "dv", "ector_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kern", "s_", "=_", "tensor_", "._", "dma", "trix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input_", "=_", "tensor_", "._", "dma", "trix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rng_", "=_", "numpy_", "._", "random_", "._", "Random", "State_", "(_", "342", "348", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "=_", "rng_", "._", "randn_", "(_", "nke", "rn_", ",_", "numpy_", "._", "prod_", "(_", "ksh", "p_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bias", "vals_", "=_", "rng_", "._", "randn_", "(_", "nke", "rn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "mode_", "in_", "(_", "'", "FAST", "\\u", "COMPIL", "E", "'_", ",_", "'", "FAST", "\\u", "RUN", "'_", ")_", ":_", "#", " ", ",", " ", "prof", "mode", "):", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tto", "t_", ",_", "nto", "t_", "=_", "0_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "conv", "\\u", "mode_", "in_", "conv", "modes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "ss_", "in_", "ssi", "zes", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "output_", ",_", "outs", "hp_", "=_", "sp_", "._", "convolve", "_", "(_", "kern", "s_", ",_", "ksh", "p_", ",_", "nke", "rn_", ",_", "input_", ",_", "ims", "hp_", ",_", "ss_", ",_", "bias_", "=_", "bias_", ",_", "mode_", "=_", "conv", "\\u", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "function_", "(_", "[_", "kern", "s_", ",_", "bias_", ",_", "input_", "]_", ",_", "output_", ",_", "mode_", "=_", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "test", " ", "with", " ", "real", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "img", "2d_", "=_", "numpy_", "._", "arange_", "(_", "bsi", "ze_", "*_", "numpy_", "._", "prod_", "(_", "ims", "hp_", ")_", ")_", "._", "reshape_", "(_", "(_", "bsi", "ze_", ",_", ")_", "+_", "ims", "hp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img", "1d_", "=_", "img", "2d_", "._", "reshape_", "(_", "bsi", "ze_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "filter", "s", " ", "(", "need", " ", "to", " ", "be", " ", "flipped", " ", "to", " ", "use", " ", "convolve", "2d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "filter", "sfl", "ipp", "ed_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "nke", "rn_", ",_", ")_", "+_", "ksh", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "range_", "(_", "nke", "rn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "it_", "=_", "reversed_", "(_", "filters_", "[_", "k_", ",_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "ksh", "p_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "j_", "in_", "range_", "(_", "ksh", "p_", "[_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "filter", "sfl", "ipp", "ed_", "[_", "k_", ",_", "i_", ",_", "j_", "]_", "=_", "next_", "(_", "it_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compute", " ", "output", " ", "with", " ", "convolve", "2d_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "conv", "\\u", "mode_", "==_", "'", "valid", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "full", "outs", "hp_", "=_", "numpy_", "._", "array_", "(_", "ims", "hp_", ")_", "-_", "numpy_", "._", "array_", "(_", "ksh", "p_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "full", "outs", "hp_", "=_", "numpy_", "._", "array_", "(_", "ims", "hp_", ")_", "+_", "numpy_", "._", "array_", "(_", "ksh", "p_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ntime", "1_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "out_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "bsi", "ze_", ",_", ")_", "+_", "tuple_", "(_", "full", "outs", "hp_", ")_", "+_", "(_", "nke", "rn_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "b_", "in_", "range_", "(_", "bsi", "ze_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "n_", "in_", "range_", "(_", "nke", "rn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ref", "out_", "[_", "b_", ",_", "..._", ",_", "n_", "]_", "=_", "convolve", "2d_", "(_", "img", "2d_", "[_", "b_", ",_", ":_", ",_", ":_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filter", "sfl", "ipp", "ed_", "[_", "n_", ",_", "..._", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "conv", "\\u", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nto", "t_", "+=_", "time_", "._", "time_", "(_", ")_", "-_", "ntime", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "need", " ", "to", " ", "flat", "ten", " ", "images_", "\\u\\u\\uNL\\u\\u\\u_", "bench", "1_", "=_", "ref", "out_", "[_", ":_", ",_", "0_", ":_", ":_", "ss_", "[_", "0_", "]_", ",_", "0_", ":_", ":_", "ss_", "[_", "1_", "]_", ",_", ":_", "]_", "._", "reshape_", "(_", "bsi", "ze_", ",_", "-_", "1_", ",_", "nke", "rn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bench", "1_", "+=_", "bias", "vals_", "._", "reshape_", "(_", "1_", ",_", "1_", ",_", "nke", "rn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "swap", " ", "the", " ", "last", " ", "two", " ", "dimension", "s", " ", "(", "output", " ", "need", "s", " ", "to", " ", "be", " ", "nke", "rn", " ", "x", " ", "outs", "hp", ")_", "\\u\\u\\uNL\\u\\u\\u_", "bench", "1_", "=_", "numpy_", "._", "swap", "axes_", "(_", "bench", "1_", ",_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tti", "me", "1_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out1_", "=_", "f_", "(_", "filters_", ",_", "bias", "vals_", ",_", "img", "1d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tto", "t_", "+=_", "time_", "._", "time_", "(_", ")_", "-_", "tti", "me", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "=_", "bench", "1_", "._", "flatten_", "(_", ")_", "-_", "out1_", "._", "flatten_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "(_", "temp_", "<_", "1e-5_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "down", "ward", " ", "propagat", "ion", " ", "--", " ", "symbolic", " ", "stuff_", "\\u\\u\\uNL\\u\\u\\u_", "#", "vis", " ", "=", " ", "tensor", ".", "grad", "(", "output", ",", " ", "input", ",", " ", "output", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "down", "prop", " ", "=", " ", "function", "([", "kern", "s", ",", "input", "],", " ", "vis", ",", " ", "mode", "=", "mode", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "vis", "val", " ", "=", " ", "down", "prop", "(", "filter", "s", ",", "img", "1d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "down", "ward", " ", "propagat", "ion", " ", "--", " ", "reference", " ", "implementation_", "\\u\\u\\uNL\\u\\u\\u_", "#", "ps", "hap", "e", " ", "=", " ", "(", "img", "1d", ".", "shape", "[", "0", "],", "nump", "y", ".", "prod", "(", "outs", "hp", "[", "1", ":]", "),", "nump", "y", ".", "prod", "(", "ksh", "p", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "patch", "stack", " ", "=", " ", "nump", "y", ".", "zero", "s", "(", "ps", "hap", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "bi", " ", "in", " ", "nump", "y", ".", "aran", "ge", "(", "ps", "hap", "e", "[", "0", "])", ":", " ", "#", " ", "batch", " ", "index_", "\\u\\u\\uNL\\u\\u\\u_", "#", "abs", "pos", " ", "=", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "out", "y", " ", "in", " ", "nump", "y", ".", "aran", "ge", "(", "outs", "hp", "[", "1", "])", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "out", "x", " ", "in", " ", "nump", "y", ".", "aran", "ge", "(", "outs", "hp", "[", "2", "])", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "ni", " ", "in", " ", "nump", "y", ".", "aran", "ge", "(", "nke", "rn", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "'", "filter", "s", "[", "n", ",:", "].", "shape", " ", "=", " ", "',", " ", "filter", "s", "[", "n", ",:", "].", "shape_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "'", "out", "1", "[", "bi", ",", "abs", "pos", "].", "shape", " ", "='", ",", "out", "1", "[", "bi", ",", "abs", "pos", "].", "shape_", "\\u\\u\\uNL\\u\\u\\u_", "#", "patch", "stack", "[", "bi", ",", "abs", "pos", ",:", "]", " ", "=", " ", "filter", "s", "[", "n", ",:", "]*", "out", "1", "[", "bi", ",", "abs", "pos", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "abs", "pos", "+=", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", "patch", "stack", " ", "=", " ", "patch", "stack", ".", "reshape", "(", "1", ",-", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "indice", "s", ",", " ", "indp", "tr", ",", " ", "spm", "at", "\\u", "shape", ",", " ", "spt", "ype", ",", " ", "outs", "hp", " ", "=", " ", "\\\\_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sp", ".", "convolution", "\\u", "indice", "s", ".", "conv", "\\u", "eval", "(", "ims", "hp", ",", "ksh", "p", ",", "ss", ",", "conv", "\\u", "mode", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "spm", "at", " ", "=", " ", "spars", "e", ".", "csc", "\\u", "matrix", "((", "nump", "y", ".", "ones", "\\u", "like", "(", "indice", "s", "),", "indice", "s", ",", "indp", "tr", "),", "spm", "at", "\\u", "shape", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "vis", "ref", " ", "=", " ", "nump", "y", ".", "dot", "(", "patch", "stack", ",", " ", "spm", "at", ".", "tod", "ense", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "'", "vis", "val", " ", "=", " ", "',", " ", "vis", "val_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "'", "vis", "ref", " ", "=", " ", "',", " ", "vis", "ref_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "assert", " ", "nump", "y", ".", "all", "(", "vis", "ref", "==", "vis", "val", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "SP_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "attr_", "(_", "'", "slow", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "sparse_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "'\\\\", "n", "\\\\", "n", "***********", "***********", "***********", "***********", "*****", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "'", " ", " ", " ", "TEST", " ", "SPAR", "SE", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "'*******", "***********", "***********", "***********", "********", "*'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fixed", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bsi", "ze_", "=_", "10_", "#", " ", "batch", " ", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ims", "hp_", "=_", "(_", "8_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ksh", "p_", "=_", "(_", "5_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nke", "rn_", "=_", "1_", "#", " ", "per", " ", "output", " ", "pixel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssi", "zes", "_", "=_", "(_", "(_", "1_", ",_", "1_", ")_", ",_", "(_", "2_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conv", "modes_", "=_", "(_", "'", "full", "'_", ",_", "'", "valid", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "symbolic", " ", "stuff_", "\\u\\u\\uNL\\u\\u\\u_", "bias_", "=_", "tensor_", "._", "dv", "ector_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kern", "s_", "=_", "tensor_", "._", "dv", "ector_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input_", "=_", "tensor_", "._", "dma", "trix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rng_", "=_", "numpy_", "._", "random_", "._", "Random", "State_", "(_", "342", "348", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "theano_", "._", "gof", "_", "as_", "gof", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "mode_", "in_", "(_", "None_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nto", "t_", ",_", "tto", "t_", "=_", "0_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "conv", "\\u", "mode_", "in_", "conv", "modes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "ss_", "in_", "ssi", "zes", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "output_", ",_", "outs", "hp_", "=_", "sp_", "._", "appl", "y", "Spar", "se", "Filter_", "(_", "kern", "s_", ",_", "ksh", "p_", ",_", "nke", "rn_", ",_", "input_", ",_", "ims", "hp_", ",_", "ss_", ",_", "bias_", "=_", "bias_", ",_", "mode_", "=_", "conv", "\\u", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "function_", "(_", "[_", "kern", "s_", ",_", "bias_", ",_", "input_", "]_", ",_", "output_", ",_", "mode_", "=_", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "build", " ", "actual", " ", "input", " ", "images_", "\\u\\u\\uNL\\u\\u\\u_", "img", "2d_", "=_", "numpy_", "._", "arange_", "(_", "bsi", "ze_", "*_", "numpy_", "._", "prod_", "(_", "ims", "hp_", ")_", ")_", "._", "reshape_", "(_", "(_", "bsi", "ze_", ",_", ")_", "+_", "ims", "hp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img", "1d_", "=_", "img", "2d_", "._", "reshape_", "(_", "bsi", "ze_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zero", "pad", "\\u", "img_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "bsi", "ze_", ",_", "img", "2d_", "._", "shape_", "[_", "1_", "]_", "+_", "2_", "*_", "(_", "ksh", "p_", "[_", "0_", "]_", "-_", "1_", ")_", ",_", "img", "2d_", "._", "shape_", "[_", "2_", "]_", "+_", "2_", "*_", "(_", "ksh", "p_", "[_", "1_", "]_", "-_", "1_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zero", "pad", "\\u", "img_", "[_", ":_", ",_", "ksh", "p_", "[_", "0_", "]_", "-_", "1_", ":_", "ksh", "p_", "[_", "0_", "]_", "-_", "1_", "+_", "img", "2d_", "._", "shape_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ksh", "p_", "[_", "1_", "]_", "-_", "1_", ":_", "ksh", "p_", "[_", "1_", "]_", "-_", "1_", "+_", "img", "2d_", "._", "shape_", "[_", "2_", "]_", "]_", "=_", "img", "2d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "build", " ", "kernel", " ", "matrix", " ", "--", " ", "flat", "ten", " ", "it", " ", "for", " ", "theano", " ", "stuff_", "\\u\\u\\uNL\\u\\u\\u_", "filters_", "=_", "numpy_", "._", "arange_", "(_", "numpy_", "._", "prod_", "(_", "outs", "hp_", ")_", "*_", "numpy_", "._", "prod_", "(_", "ksh", "p_", ")_", ")_", "._", "reshape_", "(_", "nke", "rn_", ",_", "numpy_", "._", "prod_", "(_", "outs", "hp_", "[_", "1_", ":_", "]_", ")_", ",_", "numpy_", "._", "prod_", "(_", "ksh", "p_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sp", "filt_", "=_", "filters_", "._", "flatten_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bias", "vals_", "=_", "numpy_", "._", "arange_", "(_", "numpy_", "._", "prod_", "(_", "outs", "hp_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compute", " ", "output", " ", "by", " ", "hand_", "\\u\\u\\uNL\\u\\u\\u_", "ntime", "1_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "out_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "bsi", "ze_", ",_", "nke", "rn_", ",_", "outs", "hp_", "[_", "1_", "]_", ",_", "outs", "hp_", "[_", "2_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patch_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "ksh", "p_", "[_", "0_", "]_", ",_", "ksh", "p_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "b_", "in_", "xrange_", "(_", "bsi", "ze_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "k_", "in_", "xrange_", "(_", "nke", "rn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pix", "i_", "=_", "0_", "#", " ", "pixel", " ", "index", " ", "in", " ", "rast", "er", " ", "order_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", "in_", "xrange_", "(_", "outs", "hp_", "[_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "i_", "in_", "xrange_", "(_", "outs", "hp_", "[_", "2_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "n_", "=_", "j_", "*_", "ss_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "i_", "*_", "ss_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patch_", "=_", "zero", "pad", "\\u", "img_", "[_", "b_", ",_", "n_", ":_", "n_", "+_", "ksh", "p_", "[_", "0_", "]_", ",_", "m_", ":_", "m_", "+_", "ksh", "p_", "[_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "out_", "[_", "b_", ",_", "k_", ",_", "j_", ",_", "i_", "]_", "=_", "numpy_", "._", "dot_", "(_", "filters_", "[_", "k_", ",_", "pix", "i_", ",_", ":_", "]_", ",_", "patch_", "._", "flatten_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pix", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ref", "out_", "=_", "ref", "out_", "._", "reshape_", "(_", "bsi", "ze_", ",_", "-_", "1_", ")_", "+_", "bias", "vals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nto", "t_", "+=_", "time_", "._", "time_", "(_", ")_", "-_", "ntime", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "need", " ", "to", " ", "flat", "ten", " ", "images_", "\\u\\u\\uNL\\u\\u\\u_", "tti", "me", "1_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out1_", "=_", "f_", "(_", "sp", "filt_", ",_", "bias", "vals_", ",_", "img", "1d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tto", "t_", "+=_", "time_", "._", "time_", "(_", ")_", "-_", "tti", "me", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "temp_", "=_", "ref", "out_", "-_", "out1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "temp_", "<_", "1e-10_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "down", "ward", " ", "propagat", "ion_", "\\u\\u\\uNL\\u\\u\\u_", "vis_", "=_", "tensor_", "._", "grad_", "(_", "0.5_", "*_", "tensor_", "._", "sqr", "_", "(_", "output_", ")_", "._", "sum_", "(_", ")_", ",_", "input_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "down", "prop_", "=_", "function_", "(_", "[_", "kern", "s_", ",_", "output_", "]_", ",_", "vis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "1_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "zz_", "in_", "range_", "(_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "vis", "val_", "=_", "down", "prop_", "(_", "sp", "filt_", ",_", "out1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "indices_", ",_", "indp", "tr_", ",_", "spm", "at", "\\u", "shape_", ",_", "spt", "ype_", ",_", "outs", "hp_", ",_", "kma", "p_", "=_", "sp_", "._", "convolution", "\\u", "indices_", "._", "spars", "e\\u", "eval_", "(_", "ims", "hp_", ",_", "ksh", "p_", ",_", "nke", "rn_", ",_", "ss_", ",_", "conv", "\\u", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spm", "at_", "=_", "sparse_", "._", "csc", "\\u", "matrix_", "(_", "(_", "sp", "filt_", "[_", "kma", "p_", "]_", ",_", "indices_", ",_", "indp", "tr_", ")_", ",_", "spm", "at", "\\u", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vis", "ref_", "=_", "numpy_", "._", "dot_", "(_", "out1_", ",_", "spm", "at_", "._", "tod", "ense", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "numpy_", "._", "all_", "(_", "vis", "ref_", "==_", "vis", "val_", ")_", ",_", "(_", "vis", "ref_", ",_", "vis", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "SP_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "attr_", "(_", "'", "slow", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "multil", "aye", "r", "\\u", "sparse_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "fixed", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bsi", "ze_", "=_", "10_", "#", " ", "batch", " ", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ims", "hp_", "=_", "(_", "5_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ksh", "p_", "=_", "(_", "(_", "3_", ",_", "3_", ")_", ",_", "(_", "2_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nke", "rn", "s_", "=_", "(_", "10_", ",_", "20_", ")_", "#", " ", "per", " ", "output", " ", "pixel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssi", "zes", "_", "=_", "(_", "(_", "1_", ",_", "1_", ")_", ",_", "(_", "2_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conv", "modes_", "=_", "(_", "'", "full", "'_", ",_", "'", "valid", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "symbolic", " ", "stuff_", "\\u\\u\\uNL\\u\\u\\u_", "kern", "s_", "=_", "[_", "tensor_", "._", "dv", "ector_", "(_", ")_", ",_", "tensor_", "._", "dv", "ector_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input_", "=_", "tensor_", "._", "dma", "trix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rng_", "=_", "numpy_", "._", "random_", "._", "Random", "State_", "(_", "342", "348", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "build", " ", "actual", " ", "input", " ", "images_", "\\u\\u\\uNL\\u\\u\\u_", "img", "2d_", "=_", "numpy_", "._", "arange_", "(_", "bsi", "ze_", "*_", "numpy_", "._", "prod_", "(_", "ims", "hp_", ")_", ")_", "._", "reshape_", "(_", "(_", "bsi", "ze_", ",_", ")_", "+_", "ims", "hp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img", "1d_", "=_", "img", "2d_", "._", "reshape_", "(_", "bsi", "ze_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "mode_", "in_", "(_", "'", "FAST", "\\u", "COMPIL", "E", "'_", ",_", "'", "FAST", "\\u", "RUN", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "conv", "\\u", "mode_", "in_", "conv", "modes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "ss_", "in_", "ssi", "zes", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "l1", "hid_", ",_", "l1", "outs", "hp_", "=_", "sp_", "._", "appl", "y", "Spar", "se", "Filter_", "(_", "kern", "s_", "[_", "0_", "]_", ",_", "ksh", "p_", "[_", "0_", "]_", ",_", "nke", "rn", "s_", "[_", "0_", "]_", ",_", "input_", ",_", "ims", "hp_", ",_", "ss_", ",_", "mode_", "=_", "conv", "\\u", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l2", "hid_", ",_", "l2", "outs", "hp_", "=_", "sp_", "._", "appl", "y", "Spar", "se", "Filter_", "(_", "kern", "s_", "[_", "1_", "]_", ",_", "ksh", "p_", "[_", "1_", "]_", ",_", "nke", "rn", "s_", "[_", "1_", "]_", ",_", "l1", "hid_", ",_", "l1", "outs", "hp_", ",_", "ss_", ",_", "mode_", "=_", "conv", "\\u", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "l1", "prop", "up_", "=_", "function_", "(_", "[_", "kern", "s_", "[_", "0_", "]_", ",_", "input_", "]_", ",_", "l1", "hid_", ",_", "mode_", "=_", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l2", "prop", "up_", "=_", "function_", "(_", "[_", "kern", "s_", "[_", "1_", "]_", ",_", "l1", "hid_", "]_", ",_", "l2", "hid_", ",_", "mode_", "=_", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "actual", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "l1", "kern", "vals_", "=_", "numpy_", "._", "arange_", "(_", "numpy_", "._", "prod_", "(_", "l1", "outs", "hp_", ")_", "*_", "numpy_", "._", "prod_", "(_", "ksh", "p_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l2", "kern", "vals_", "=_", "numpy_", "._", "arange_", "(_", "numpy_", "._", "prod_", "(_", "l2", "outs", "hp_", ")_", "*_", "numpy_", "._", "prod_", "(_", "ksh", "p_", "[_", "1_", "]_", ")_", "*_", "nke", "rn", "s_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l1", "hid", "val_", "=_", "l1", "prop", "up_", "(_", "l1", "kern", "vals_", ",_", "img", "1d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l2", "hid", "val_", "=_", "l2", "prop", "up_", "(_", "l2", "kern", "vals_", ",_", "l1", "hid", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "SP_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "multil", "aye", "r", "\\u", "conv_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "fixed", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bsi", "ze_", "=_", "10_", "#", " ", "batch", " ", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ims", "hp_", "=_", "(_", "5_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ksh", "p_", "=_", "(_", "(_", "3_", ",_", "3_", ")_", ",_", "(_", "2_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nke", "rn", "s_", "=_", "(_", "3_", ",_", "6_", ")_", "#", " ", "per", " ", "output", " ", "pixel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssi", "zes", "_", "=_", "(_", "(_", "(_", "1_", ",_", "1_", ")_", ",_", "(_", "2_", ",_", "2_", ")_", ")_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conv", "modes_", "=_", "(_", "'", "full", "'_", ",_", ")_", "#", " ", "'", "valid", "',", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "symbolic", " ", "stuff_", "\\u\\u\\uNL\\u\\u\\u_", "kern", "s_", "=_", "[_", "tensor_", "._", "dma", "trix_", "(_", ")_", ",_", "tensor_", "._", "dma", "trix_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input_", "=_", "tensor_", "._", "dma", "trix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rng_", "=_", "numpy_", "._", "random_", "._", "Random", "State_", "(_", "342", "348", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "build", " ", "actual", " ", "input", " ", "images_", "\\u\\u\\uNL\\u\\u\\u_", "img", "2d_", "=_", "numpy_", "._", "arange_", "(_", "bsi", "ze_", "*_", "numpy_", "._", "prod_", "(_", "ims", "hp_", ")_", ")_", "._", "reshape_", "(_", "(_", "bsi", "ze_", ",_", ")_", "+_", "ims", "hp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img", "1d_", "=_", "img", "2d_", "._", "reshape_", "(_", "bsi", "ze_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "mode_", "in_", "(_", "'", "FAST", "\\u", "COMPIL", "E", "'_", ",_", "'", "FAST", "\\u", "RUN", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "conv", "\\u", "mode_", "in_", "conv", "modes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "ss_", "in_", "ssi", "zes", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "l1", "hid_", ",_", "l1", "shp_", "=_", "sp_", "._", "convolve", "_", "(_", "kern", "s_", "[_", "0_", "]_", ",_", "ksh", "p_", "[_", "0_", "]_", ",_", "nke", "rn", "s_", "[_", "0_", "]_", ",_", "input_", ",_", "ims", "hp_", ",_", "ss_", "[_", "0_", "]_", ",_", "mode_", "=_", "conv", "\\u", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l1", "prop", "up_", "=_", "function_", "(_", "[_", "kern", "s_", "[_", "0_", "]_", ",_", "input_", "]_", ",_", "l1", "hid_", ",_", "mode_", "=_", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "l1", "kern", "vals", " ", "=", " ", "nump", "y", ".", "random", ".", "rand", "(", "nke", "rn", "s", "[", "0", "],", "nump", "y", ".", "prod", "(", "ksh", "p", "[", "0", "]))", "_", "\\u\\u\\uNL\\u\\u\\u_", "l1", "kern", "vals_", "=_", "numpy_", "._", "arange_", "(_", "nke", "rn", "s_", "[_", "0_", "]_", "*_", "numpy_", "._", "prod_", "(_", "ksh", "p_", "[_", "0_", "]_", ")_", ")_", "._", "reshape_", "(_", "nke", "rn", "s_", "[_", "0_", "]_", ",_", "numpy_", "._", "prod_", "(_", "ksh", "p_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l1", "hid", "val_", "=_", "l1", "prop", "up_", "(_", "l1", "kern", "vals_", ",_", "img", "1d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "actual", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "l2", "hid_", ",_", "l2", "shp_", "=_", "sp_", "._", "convolve", "_", "(_", "kern", "s_", "[_", "1_", "]_", ",_", "ksh", "p_", "[_", "1_", "]_", ",_", "nke", "rn", "s_", "[_", "1_", "]_", ",_", "l1", "hid_", ",_", "l1", "shp_", ",_", "ss_", "[_", "1_", "]_", ",_", "mode_", "=_", "conv", "\\u", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l2", "prop", "up_", "=_", "function_", "(_", "[_", "kern", "s_", "[_", "1_", "]_", ",_", "l1", "hid_", "]_", ",_", "l2", "hid_", ",_", "mode_", "=_", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "l2", "kern", "vals", " ", "=", " ", "nump", "y", ".", "random", ".", "rand", "(", "nke", "rn", "s", "[", "1", "],", "nump", "y", ".", "prod", "(", "ksh", "p", "[", "1", "])", "*", "nke", "rn", "s", "[", "0", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "l2", "kern", "vals_", "=_", "numpy_", "._", "arange_", "(_", "nke", "rn", "s_", "[_", "1_", "]_", "*_", "numpy_", "._", "prod_", "(_", "ksh", "p_", "[_", "1_", "]_", ")_", "*_", "nke", "rn", "s_", "[_", "0_", "]_", ")_", "._", "reshape_", "(_", "nke", "rn", "s_", "[_", "1_", "]_", ",_", "numpy_", "._", "prod_", "(_", "ksh", "p_", "[_", "1_", "]_", ")_", "*_", "nke", "rn", "s_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "for", " ", "debugg", "ing", ",", " ", "we", " ", "bring", " ", "thing", "s", " ", "back", " ", "to", " ", "integers_", "\\u\\u\\uNL\\u\\u\\u_", "l1", "hid", "val_", "=_", "numpy_", "._", "arange_", "(_", "numpy_", "._", "size_", "(_", "l1", "hid", "val_", ")_", ")_", "._", "reshape_", "(_", "l1", "hid", "val_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "l2", "hid", "val_", "=_", "l2", "prop", "up_", "(_", "l2", "kern", "vals_", ",_", "l1", "hid", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "SP_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "maxp", "ool_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "generat", "e", " ", "flat", "ted", " ", "images_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "maxp", "ool", "shp", "s_", "=_", "(_", "(_", "2_", ",_", "2_", ")_", ",_", "(_", "3_", ",_", "3_", ")_", ",_", "(_", "4_", ",_", "4_", ")_", ",_", "(_", "5_", ",_", "5_", ")_", ",_", "(_", "6_", ",_", "6_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "val_", "=_", "numpy_", "._", "random_", "._", "rand_", "(_", "4_", ",_", "5_", ",_", "10_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "images_", "=_", "tensor_", "._", "dma", "trix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "maxp", "ool", "shp_", "in_", "maxp", "ool", "shp", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "symbolic", " ", "stuff_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", ",_", "outs", "hp_", "=_", "sp_", "._", "max", "\\u", "pool_", "(_", "images_", ",_", "im", "val_", "._", "shape_", "[_", "1_", ":_", "]_", ",_", "maxp", "ool", "shp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "function_", "(_", "[_", "images_", ",_", "]_", ",_", "[_", "output_", ",_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "val_", "=_", "f_", "(_", "im", "val_", "._", "reshape_", "(_", "im", "val_", "._", "shape_", "[_", "0_", "]_", ",_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "numeri", "c", " ", "verification", "_", "\\u\\u\\uNL\\u\\u\\u_", "my", "\\u", "output", "\\u", "val_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "im", "val_", "._", "shape_", "[_", "0_", "]_", ",_", "im", "val_", "._", "shape_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "im", "val_", "._", "shape_", "[_", "2_", "]_", "//_", "maxp", "ool", "shp_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "im", "val_", "._", "shape_", "[_", "3_", "]_", "//_", "maxp", "ool", "shp_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "numpy_", "._", "prod_", "(_", "my", "\\u", "output", "\\u", "val_", "._", "shape_", "[_", "1_", ":_", "]_", ")_", "==_", "numpy_", "._", "prod_", "(_", "numpy_", "._", "r\\u_", "[_", "im", "val_", "._", "shape_", "[_", "1_", "]_", ",_", "outs", "hp_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "n_", "in_", "range_", "(_", "im", "val_", "._", "shape_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k_", "in_", "range_", "(_", "im", "val_", "._", "shape_", "[_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "i_", "in_", "range_", "(_", "im", "val_", "._", "shape_", "[_", "2_", "]_", "//_", "maxp", "ool", "shp_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "j_", "in_", "range_", "(_", "im", "val_", "._", "shape_", "[_", "3_", "]_", "//_", "maxp", "ool", "shp_", "[_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ii_", ",_", "jj_", "=_", "i_", "*_", "maxp", "ool", "shp_", "[_", "0_", "]_", ",_", "j_", "*_", "maxp", "ool", "shp_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patch_", "=_", "im", "val_", "[_", "n_", ",_", "k_", ",_", "ii_", ":_", "ii_", "+_", "maxp", "ool", "shp_", "[_", "0_", "]_", ",_", "jj_", ":_", "jj_", "+_", "maxp", "ool", "shp_", "[_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "my", "\\u", "output", "\\u", "val_", "[_", "n_", ",_", "k_", ",_", "i_", ",_", "j_", "]_", "=_", "numpy_", "._", "max_", "(_", "patch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "my", "\\u", "output", "\\u", "val_", "=_", "my", "\\u", "output", "\\u", "val_", "._", "reshape_", "(_", "im", "val_", "._", "shape_", "[_", "0_", "]_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "numpy_", "._", "all_", "(_", "output", "\\u", "val_", "==_", "my", "\\u", "output", "\\u", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "mp_", "(_", "input_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", ",_", "outs", "hp_", "=_", "sp_", "._", "max", "\\u", "pool_", "(_", "input_", ",_", "im", "val_", "._", "shape_", "[_", "1_", ":_", "]_", ",_", "maxp", "ool", "shp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "utt", "_", "._", "verify", "\\u", "grad_", "(_", "mp_", ",_", "[_", "im", "val_", "._", "reshape_", "(_", "im", "val_", "._", "shape_", "[_", "0_", "]_", ",_", "-_", "1_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "SP_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "CS", "MG", "rad_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ims", "hp_", "=_", "(_", "3_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nke", "rn_", "=_", "1_", "#", " ", "per", " ", "output", " ", "pixel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ksh", "p_", "=_", "(_", "2_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "ssi", "zes", " ", "=", " ", "((", "1", ",", "1", "),", "(", "2", ",", "2", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "ssi", "zes", "_", "=_", "(_", "(_", "1_", ",_", "1_", ")_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "conv", "mode", "s", " ", "=", " ", "('", "full", "','", "valid", "',", ")_", "\\u\\u\\uNL\\u\\u\\u_", "conv", "modes_", "=_", "(_", "'", "full", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kern", "s_", "=_", "tensor_", "._", "dv", "ector_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "indices_", "=_", "tensor_", "._", "ive", "ctor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "indp", "tr_", "=_", "tensor_", "._", "ive", "ctor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spm", "at", "\\u", "shape_", "=_", "tensor_", "._", "ive", "ctor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "mode_", "in_", "[_", "'", "FAST", "\\u", "COMPIL", "E", "'_", ",_", "'", "FAST", "\\u", "RUN", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "conv", "\\u", "mode_", "in_", "conv", "modes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "ss_", "in_", "ssi", "zes", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ind", "vals_", ",_", "indp", "tr", "vals_", ",_", "sps", "hap", "evals_", ",_", "spt", "ype_", ",_", "outs", "hp_", ",_", "kma", "p_", "=_", "sp_", "._", "convolution", "\\u", "indices_", "._", "spars", "e\\u", "eval_", "(_", "ims", "hp_", ",_", "ksh", "p_", ",_", "nke", "rn_", ",_", "ss_", ",_", "conv", "\\u", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kv", "als_", "=_", "numpy_", "._", "random_", "._", "random_", "(_", "nke", "rn_", "*_", "numpy_", "._", "prod_", "(_", "ksh", "p_", ")_", "*_", "numpy_", "._", "prod_", "(_", "outs", "hp_", ")_", ")_", "._", "flatten_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "d_", "(_", "kern", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "theano_", "._", "sparse_", "._", "dens", "e\\u", "from", "\\u", "sparse_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "theano_", "._", "sparse_", "._", "CS", "M_", "(_", "spt", "ype_", ",_", "kma", "p_", ")_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "kern", "s_", ",_", "ind", "vals_", ",_", "indp", "tr", "vals_", ",_", "sps", "hap", "evals_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "symbolic", " ", "stuff_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "utt", "_", "._", "verify", "\\u", "grad_", "(_", "d_", ",_", "[_", "kv", "als_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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, 2, 2, 2, 2, 2, 2 ]
Unused import
codalab/codalab-cli/tests/lib/worksheet_util_test.py
[ { "content": "import errno\nimport hashlib\nimport mock\nimport os\nimport unittest\n\nfrom codalab.common import PreconditionViolation\nfrom codalab.lib import worksheet_util\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class WorksheetUtilTest(unittest.TestCase):", "metadata": "root.WorksheetUtilTest", "header": "['module', '___EOS___']", "index": 9 }, { "content": " def test_apply_func(self):\n '''\n Test apply_func for rendering values in worksheets.\n '''\n self.assertEqual(worksheet_util.apply_func(None, 'hello'), 'hello')\n self.assertEqual(worksheet_util.apply_func('[1:2]', 'hello'), 'e')\n self.assertEqual(worksheet_util.apply_func('[:2]', 'hello'), 'he')\n self.assertEqual(worksheet_util.apply_func('[2:]', 'hello'), 'llo')\n self.assertEqual(worksheet_util.apply_func('date', '1427467247')[:10], '2015-03-27') # Don't test time because of time zones\n self.assertEqual(worksheet_util.apply_func('duration', '63'), '1m3s')\n self.assertEqual(worksheet_util.apply_func('size', '1024'), '1k')\n self.assertEqual(worksheet_util.apply_func('s/a/b', 'aa'), 'bb')\n self.assertEqual(worksheet_util.apply_func(r's/(.+)\\/(.+)/\\2\\/\\1', '3/10'), '10/3')\n self.assertEqual(worksheet_util.apply_func('%.2f', '1.2345'), '1.23')", "metadata": "root.WorksheetUtilTest.test_apply_func", "header": "['class', 'WorksheetUtilTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 10 } ]
[ { "span": "import errno", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 12 }, { "span": "import hashlib", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 14 }, { "span": "import mock", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 11 }, { "span": "import os", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 9 }, { "span": "from codalab.common import PreconditionViolation", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 48 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "errno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hashlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "cod", "ala", "b_", "._", "common_", "import_", "Precon", "dition", "Violation", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cod", "ala", "b_", "._", "lib_", "import_", "worksheet", "\\u", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Worksh", "eet", "Ut", "il", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Worksh", "eet", "Ut", "il", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "appl", "y", "\\u", "func_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "appl", "y", "\\u", "func", " ", "for", " ", "render", "ing", " ", "values", " ", "in", " ", "worksheet", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "worksheet", "\\u", "util_", "._", "appl", "y", "\\u", "func_", "(_", "None_", ",_", "'", "hell", "o", "'_", ")_", ",_", "'", "hell", "o", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "worksheet", "\\u", "util_", "._", "appl", "y", "\\u", "func_", "(_", "'[", "1", ":", "2", "]'_", ",_", "'", "hell", "o", "'_", ")_", ",_", "'", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "worksheet", "\\u", "util_", "._", "appl", "y", "\\u", "func_", "(_", "'[", ":", "2", "]'_", ",_", "'", "hell", "o", "'_", ")_", ",_", "'", "he", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "worksheet", "\\u", "util_", "._", "appl", "y", "\\u", "func_", "(_", "'[", "2", ":]", "'_", ",_", "'", "hell", "o", "'_", ")_", ",_", "'", "llo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "worksheet", "\\u", "util_", "._", "appl", "y", "\\u", "func_", "(_", "'", "date", "'_", ",_", "'", "142", "746", "724", "7", "'_", ")_", "[_", ":_", "10_", "]_", ",_", "'", "201", "5", "-0", "3", "-", "2", "7", "'_", ")_", "#", " ", "Don", "'", "t", " ", "test", " ", "time", " ", "bec", "aus", "e", " ", "of", " ", "time", " ", "zones_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "worksheet", "\\u", "util_", "._", "appl", "y", "\\u", "func_", "(_", "'", "duration", "'_", ",_", "'", "6", "3", "'_", ")_", ",_", "'", "1", "m3", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "worksheet", "\\u", "util_", "._", "appl", "y", "\\u", "func_", "(_", "'", "size", "'_", ",_", "'", "1024", "'_", ")_", ",_", "'", "1", "k", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "worksheet", "\\u", "util_", "._", "appl", "y", "\\u", "func_", "(_", "'", "s", "/", "a", "/", "b", "'_", ",_", "'", "aa", "'_", ")_", ",_", "'", "bb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "worksheet", "\\u", "util_", "._", "appl", "y", "\\u", "func_", "(_", "r", "'", "s", "/(.", "+)\\\\", "/(.", "+)", "/\\\\", "2", "\\\\/\\", "\\", "1", "'_", ",_", "'", "3", "/", "10", "'_", ")_", ",_", "'", "10", "/", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "worksheet", "\\u", "util_", "._", "appl", "y", "\\u", "func_", "(_", "'%", ".2", "f", "'_", ",_", "'", "1.23", "4", "5", "'_", ")_", ",_", "'", "1.23", "'_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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ame.f_back\n\tco = f.f_code\n\ti = f.f_lasti\n\tcode = co.co_code\n\tif ord(code[i]) == CALL_FUNCTION and ord(code[i+3]) == UNPACK_SEQUENCE:\n\t i += 3\n\t n = ord(code[i+1]) + ord(code[i+2])*256\n\t i += 3\n\t names = []\n\t while len(names) < n and i < len(code):\n\t\top = ord(code[i])\n\t\ti += 1\n\t\tif op >= HAVE_ARGUMENT:\n\t\t oparg = ord(code[i]) + ord(code[i+1])*256\n\t\t i += 2\n\t\t if op == STORE_FAST:\n\t\t\tnames.append(co.co_varnames[oparg])\n\t\t elif op in (STORE_NAME, STORE_ATTR, STORE_GLOBAL):\n\t\t\tnames.append(co.co_names[oparg])\n\t\tif op == STORE_SUBSCR or STORE_SLICE <= op <= STORE_SLICE+3:\n\t\t break\n\t if len(names) == n:\n\t\tr = []\n\t\tfor name in names:\n\t\t try:\n\t\t\tv = getattr(x, name)\n\t\t except AttributeError:\n\t\t\tv = x[name]\n\t\t r.append(v)\n\t\treturn r\n\traise SyntaxError", "metadata": "root.unpack", "header": "['module', '___EOS___']", "index": 14 } ]
[ { "span": "except:", "start_line": 17, "start_column": 4, "end_line": 17, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "unpack_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "1_", "/_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "typ_", ",_", "value_", ",_", "traceback_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "traceback_", "._", "tb", "\\u", "frame_", "._", "f", "\\u", "back_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "co_", "=_", "f_", "._", "f", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "f_", "._", "f", "\\u", "lasti", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "co_", "._", "co", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ord_", "(_", "code_", "[_", "i_", "]_", ")_", "==_", "CALL", "\\u", "FUNCTION_", "and_", "ord_", "(_", "code_", "[_", "i_", "+_", "3_", "]_", ")_", "==_", "UNP", "AC", "K", "\\u", "SEQUENCE", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " _", "i_", "+=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "ord_", "(_", "code_", "[_", "i_", "+_", "1_", "]_", ")_", "+_", "ord_", "(_", "code_", "[_", "i_", "+_", "2_", "]_", ")_", "*_", "256_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "len_", "(_", "names_", ")_", "<_", "n_", "and_", "i_", "<_", "len_", "(_", "code_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "op_", "=_", "ord_", "(_", "code_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "op_", ">=_", "HA", "VE", "\\u", "ARGUMENT", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t _", "opa", "rg_", "=_", "ord_", "(_", "code_", "[_", "i_", "]_", ")_", "+_", "ord_", "(_", "code_", "[_", "i_", "+_", "1_", "]_", ")_", "*_", "256_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "op_", "==_", "STORE", "\\u", "FAST", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "names_", "._", "append_", "(_", "co_", "._", "co", "\\u", "varnames", "_", "[_", "opa", "rg_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "in_", "(_", "STORE", "\\u", "NAME_", ",_", "STORE", "\\u", "ATTR_", ",_", "STORE", "\\u", "GLOBAL_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "names_", "._", "append_", "(_", "co_", "._", "co", "\\u", "names_", "[_", "opa", "rg_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "op_", "==_", "STORE", "\\u", "SUBS", "CR", "_", "or_", "STORE", "\\u", "SLI", "CE_", "<=_", "op_", "<=_", "STORE", "\\u", "SLI", "CE_", "+_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "names_", ")_", "==_", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "r_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "v_", "=_", "getattr_", "(_", "x_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "v_", "=_", "x_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "r_", "._", "append_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Syntax", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
karesansui/karesansui/bin/read_conf.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# This file is part of Karesansui.\n#\n# Copyright (C) 2012 HDE, Inc.\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# THE SOFTWARE.\n#\n\nimport os\nimport os.path\nimport sys\nimport re\nimport time\nimport signal\nimport logging\nfrom optparse import OptionParser\n\nfrom ksscommand import KssCommand, KssCommandException, KssCommandOptException\n\nimport __cmd__\n\ntry:\n import karesansui\n from karesansui import __version__\n from karesansui.lib.utils import load_locale\n from karesansui.lib.utils import preprint_r\n from karesansui.lib.dict_op import DictOp\n from karesansui.lib.file.configfile import ConfigFile\n from karesansui.lib.utils import python_dict_to_php_array\n\nexcept ImportError, e:\n print >>sys.stderr, \"[Error] some packages not found. - %s\" % e\n sys.exit(1)\n\n_ = load_locale()\n\nusage = '%prog [options]'\n\n\n\n\n\nif __name__ == \"__main__\":\n target = ReadConf()\n sys.exit(target.run())\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def getopts():\n optp = OptionParser(usage=usage, version=__version__)\n optp.add_option('-m', '--module', dest='module', help=_('Module name'))\n optp.add_option('-o', '--output-file', dest='file', help=_('Output file name'))\n optp.add_option('-R', '--raw', dest='raw', action=\"store_true\", default=False, help=_('Print by raw format'))\n optp.add_option('-P', '--php', dest='php', action=\"store_true\", default=False, help=_('Print by php format'))\n optp.add_option('-q', '--quiet',dest='verbose', action=\"store_false\", default=True, help=_(\"don't print status messages\"))\n optp.add_option('-H', '--host', dest='host', help=_('Host name'))\n optp.add_option('-U', '--auth-user', dest='auth_user', help=_('Auth user name'))\n optp.add_option('-W', '--auth-password-file', dest='auth_password_file', help=_('Read auth password from file'))\n optp.add_option('-I', '--include', dest='include', help=_('Include key'), default=None)\n\n return optp.parse_args()", "metadata": "root.getopts", "header": "['module', '___EOS___']", "index": 56 }, { "content": "def chkopts(opts):\n if not opts.module:\n raise KssCommandOptException(\"ERROR: -m or --module option is required.\")\n\n modules = opts.module.split(\":\")\n for _mod in modules:\n try:\n exec(\"from karesansui.lib.parser.%s import %sParser\" % (_mod,_mod,))\n except:\n raise KssCommandOptException(\"ERROR: module not found. - %s\" % opts.module)\n\n if not opts.file:\n opts.file = \"/dev/stdout\"\n for _cnt in range(1,len(modules)):\n opts.file = \"%s:/dev/stdout\" % opts.file\n\n files = opts.file.split(\":\")\n\n if len(modules) != len(files):\n raise KssCommandOptException(\"ERROR: not same number of modules and files. - module:%d file:%d\" % (len(modules),len(files),))\n\n if opts.raw is True and opts.php is True:\n raise KssCommandOptException(\"ERROR: cannot specify --raw and --php option at same time.\")", "metadata": "root.chkopts", "header": "['module', '___EOS___']", "index": 70 }, { "content": "class ReadConf(KssCommand):\n", "metadata": "root.ReadConf", "header": "['module', '___EOS___']", "index": 95 }, { "content": " def process(self):\n (opts, args) = getopts()\n chkopts(opts)\n self.up_progress(1)\n\n dop = DictOp()\n modules = opts.module.split(\":\")\n files = opts.file.split(\":\")\n\n retval = True\n cnt = 0\n for _mod in modules:\n _file = files[cnt]\n try:\n exec(\"from karesansui.lib.parser.%s import %sParser as Parser\" % (_mod,_mod,))\n\n self.up_progress(5)\n parser = Parser()\n\n self.up_progress(5)\n if opts.raw is True:\n raw_str = \"Config_Raw_%s = {}\\n\" % (_mod,)\n for _src in parser.source_file():\n raw_str = \"%sConfig_Raw_%s['%s'] = \\\"\\\"\\\"%s\\\"\\\"\\\"\\n\" % (raw_str,_mod,_src,open(_src).read())\n ConfigFile(_file).write(raw_str)\n\n else:\n # 設定ファイルの読み込み\n extra_args = {}\n extra_args[\"include\"] = opts.include\n conf_arr = parser.read_conf(extra_args=extra_args)\n dop.addconf(_mod,conf_arr)\n #dop.preprint_r(_mod)\n\n # 辞書配列ファイルに書き込み\n _var = \"Config_Dict_%s\" % (_mod,)\n if opts.php is True:\n _str = python_dict_to_php_array(dop.getconf(_mod),_var)\n ConfigFile(_file).write(_str)\n else:\n ConfigFile(_file).write(\"%s = %s\\n\" % (_var,str(dop.getconf(_mod)),))\n\n finally:\n cnt = cnt + 1\n\n self.up_progress(10)\n return True", "metadata": "root.ReadConf.process", "header": "['class', 'ReadConf', '(', 'KssCommand', ')', ':', '___EOS___']", "index": 97 } ]
[ { "span": "import os", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 9 }, { "span": "import os.path", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 14 }, { "span": "import re", "start_line": 29, "start_column": 0, "end_line": 29, "end_column": 9 }, { "span": "import time", "start_line": 30, "start_column": 0, "end_line": 30, "end_column": 11 }, { "span": "import signal", "start_line": 31, "start_column": 0, "end_line": 31, "end_column": 13 }, { "span": "import logging", "start_line": 32, "start_column": 0, "end_line": 32, "end_column": 14 }, { "span": "from ksscommand import KssCommand, KssCommandException, KssCommandOptException", "start_line": 35, "start_column": 0, "end_line": 35, "end_column": 78 }, { "span": "import karesansui", "start_line": 40, "start_column": 4, "end_line": 40, "end_column": 21 }, { "span": "from karesansui.lib.utils import preprint_r", "start_line": 43, "start_column": 4, "end_line": 43, "end_column": 47 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "Kar", "esa", "nsu", "i", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2012", " ", "HD", "E", ",", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", " ", "obtain", "ing", " ", "a", " ", "copy_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", " ", "condition", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", " ", "include", "d", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "EXPR", "ESS", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "signal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "optparse_", "import_", "Optio", "n", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ks", "sco", "mmand", "_", "import_", "Ks", "s", "Command_", ",_", "Ks", "s", "Command", "Exception_", ",_", "Ks", "s", "Command", "Opt", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "\\u\\u", "cmd", "\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "kar", "esa", "nsu", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "import_", "\\u\\u", "version\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "utils_", "import_", "load", "\\u", "locale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "utils_", "import_", "prep", "rint", "\\u", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "dict", "\\u", "op_", "import_", "Dict", "Op_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "file_", "._", "configfile_", "import_", "Config", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "utils_", "import_", "python", "\\u", "dict", "\\u", "to", "\\u", "php", "\\u", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "\"[", "Error", "]", " ", "some", " ", "package", "s", " ", "not", " ", "found", ".", " ", "-", " ", "%", "s", "\"_", "%_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u_", "=_", "load", "\\u", "locale_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "usage_", "=_", "'%", "prog", " ", "[", "options", "]'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "=_", "Read", "Conf_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "target_", "._", "run_", "(_", ")_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "getop", "ts_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opt", "p_", "=_", "Optio", "n", "Parser_", "(_", "usage_", "=_", "usage_", ",_", "version_", "=_", "\\u\\u", "version\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "p_", "._", "add", "\\u", "option_", "(_", "'-", "m", "'_", ",_", "'--", "module", "'_", ",_", "dest_", "=_", "'", "module", "'_", ",_", "help_", "=_", "\\u_", "(_", "'", "Modul", "e", " ", "name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "p_", "._", "add", "\\u", "option_", "(_", "'-", "o", "'_", ",_", "'--", "output", "-", "file", "'_", ",_", "dest_", "=_", "'", "file", "'_", ",_", "help_", "=_", "\\u_", "(_", "'", "Output", " ", "file", " ", "name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "p_", "._", "add", "\\u", "option_", "(_", "'-", "R", "'_", ",_", "'--", "raw", "'_", ",_", "dest_", "=_", "'", "raw", "'_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "default_", "=_", "False_", ",_", "help_", "=_", "\\u_", "(_", "'", "Print", " ", "by", " ", "raw", " ", "format", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "p_", "._", "add", "\\u", "option_", "(_", "'-", "P", "'_", ",_", "'--", "php", "'_", ",_", "dest_", "=_", "'", "php", "'_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "default_", "=_", "False_", ",_", "help_", "=_", "\\u_", "(_", "'", "Print", " ", "by", " ", "php", " ", "format", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "p_", "._", "add", "\\u", "option_", "(_", "'-", "q", "'_", ",_", "'--", "quie", "t", "'_", ",_", "dest_", "=_", "'", "verbo", "se", "'_", ",_", "action_", "=_", "\"", "store", "\\u", "fal", "se", "\"_", ",_", "default_", "=_", "True_", ",_", "help_", "=_", "\\u_", "(_", "\"", "don", "'", "t", " ", "print", " ", "status", " ", "message", "s", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "p_", "._", "add", "\\u", "option_", "(_", "'-", "H", "'_", ",_", "'--", "host", "'_", ",_", "dest_", "=_", "'", "host", "'_", ",_", "help_", "=_", "\\u_", "(_", "'", "Host", " ", "name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "p_", "._", "add", "\\u", "option_", "(_", "'-", "U", "'_", ",_", "'--", "auth", "-", "user", "'_", ",_", "dest_", "=_", "'", "auth", "\\u", "user", "'_", ",_", "help_", "=_", "\\u_", "(_", "'", "Auth", " ", "user", " ", "name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "p_", "._", "add", "\\u", "option_", "(_", "'-", "W", "'_", ",_", "'--", "auth", "-", "password", "-", "file", "'_", ",_", "dest_", "=_", "'", "auth", "\\u", "password", "\\u", "file", "'_", ",_", "help_", "=_", "\\u_", "(_", "'", "Read", " ", "auth", " ", "password", " ", "from", " ", "file", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "p_", "._", "add", "\\u", "option_", "(_", "'-", "I", "'_", ",_", "'--", "include", "'_", ",_", "dest_", "=_", "'", "include", "'_", ",_", "help_", "=_", "\\u_", "(_", "'", "Include", " ", "key", "'_", ")_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "opt", "p_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "chk", "opts_", "(_", "opts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "opts_", "._", "module_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ks", "s", "Command", "Opt", "Exception_", "(_", "\"", "ERROR", ":", " ", "-", "m", " ", "or", " ", "--", "module", " ", "option", " ", "is", " ", "require", "d", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "modules_", "=_", "opts_", "._", "module_", "._", "split_", "(_", "\":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "mod_", "in_", "modules_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exec_", "(_", "\"", "from", " ", "kar", "esa", "nsu", "i", ".", "lib", ".", "parser", ".", "%", "s", " ", "import", " ", "%", "s", "Parser", "\"_", "%_", "(_", "\\u", "mod_", ",_", "\\u", "mod_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ks", "s", "Command", "Opt", "Exception_", "(_", "\"", "ERROR", ":", " ", "module", " ", "not", " ", "found", ".", " ", "-", " ", "%", "s", "\"_", "%_", "opts_", "._", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "opts_", "._", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opts_", "._", "file_", "=_", "\"/", "dev", "/", "stdout", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "cnt_", "in_", "range_", "(_", "1_", ",_", "len_", "(_", "modules_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opts_", "._", "file_", "=_", "\"%", "s", ":/", "dev", "/", "stdout", "\"_", "%_", "opts_", "._", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "files_", "=_", "opts_", "._", "file_", "._", "split_", "(_", "\":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "modules_", ")_", "!=_", "len_", "(_", "files_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ks", "s", "Command", "Opt", "Exception_", "(_", "\"", "ERROR", ":", " ", "not", " ", "same", " ", "number", " ", "of", " ", "module", "s", " ", "and", " ", "files", ".", " ", "-", " ", "module", ":", "%", "d", " ", "file", ":", "%", "d", "\"_", "%_", "(_", "len_", "(_", "modules_", ")_", ",_", "len_", "(_", "files_", ")_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opts_", "._", "raw_", "is_", "True_", "and_", "opts_", "._", "php", "_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ks", "s", "Command", "Opt", "Exception_", "(_", "\"", "ERROR", ":", " ", "cann", "ot", " ", "speci", "fy", " ", "--", "raw", " ", "and", " ", "--", "php", " ", "option", " ", "at", " ", "same", " ", "time", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Read", "Conf_", "(_", "Ks", "s", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Read", "Conf_", "(_", "Ks", "s", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "process_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "opts_", ",_", "args_", ")_", "=_", "getop", "ts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chk", "opts_", "(_", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "up", "\\u", "progress_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dop", "_", "=_", "Dict", "Op_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modules_", "=_", "opts_", "._", "module_", "._", "split_", "(_", "\":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files_", "=_", "opts_", "._", "file_", "._", "split_", "(_", "\":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "retval_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cnt_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "mod_", "in_", "modules_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "file_", "=_", "files_", "[_", "cnt_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exec_", "(_", "\"", "from", " ", "kar", "esa", "nsu", "i", ".", "lib", ".", "parser", ".", "%", "s", " ", "import", " ", "%", "s", "Parser", " ", "as", " ", "Parser", "\"_", "%_", "(_", "\\u", "mod_", ",_", "\\u", "mod_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "up", "\\u", "progress_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "=_", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "up", "\\u", "progress_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "opts_", "._", "raw_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raw", "\\u", "str_", "=_", "\"", "Config", "\\u", "Ra", "w", "\\u", "%", "s", " ", "=", " ", "{}", "\\\\", "n", "\"_", "%_", "(_", "\\u", "mod_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "src_", "in_", "parser_", "._", "source", "\\u", "file_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raw", "\\u", "str_", "=_", "\"%", "s", "Config", "\\u", "Ra", "w", "\\u", "%", "s", "['", "%", "s", "']", " ", "=", " ", "\\\\\"\\\\\"", "\\\\\"", "%", "s", "\\\\\"\\\\\"", "\\\\\"", "\\\\", "n", "\"_", "%_", "(_", "raw", "\\u", "str_", ",_", "\\u", "mod_", ",_", "\\u", "src_", ",_", "open_", "(_", "\\u", "src_", ")_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Config", "File_", "(_", "\\u", "file_", ")_", "._", "write_", "(_", "raw", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "\\", "353", "7", "3", ";", "\\", "2345", "0", ";", "\\", "1250", "1", ";", "\\", "124", "4", "9", ";", "\\", "124", "5", "2", ";", "\\", "1252", "3", ";", "\\", "123", "98", ";", "\\", "355", "01", ";", "\\", "124", "15", ";", "\\", "367", "96", ";", "\\", "124", "15", ";_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "extra", "\\u", "args_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "args_", "[_", "\"", "include", "\"_", "]_", "=_", "opts_", "._", "include_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf", "\\u", "arr_", "=_", "parser_", "._", "read", "\\u", "conf_", "(_", "extra", "\\u", "args_", "=_", "extra", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dop", "_", "._", "addc", "onf_", "(_", "\\u", "mod_", ",_", "conf", "\\u", "arr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "dop", ".", "prep", "rint", "\\u", "r", "(\\u", "mod", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\", "367", "6", "6", ";", "\\", "263", "60", ";", "\\", "371", "9", "7", ";", "\\", "210", "15", ";", "\\", "1250", "1", ";", "\\", "124", "4", "9", ";", "\\", "124", "5", "2", ";", "\\", "1252", "3", ";", "\\", "123", "9", "5", ";", "\\", "263", "60", ";", "\\", "123", "6", "5", ";", "\\", "367", "96", ";", "\\", "124", "15", ";_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "var_", "=_", "\"", "Config", "\\u", "Dict", "\\u", "%", "s", "\"_", "%_", "(_", "\\u", "mod_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "opts_", "._", "php", "_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "str_", "=_", "python", "\\u", "dict", "\\u", "to", "\\u", "php", "\\u", "array_", "(_", "dop", "_", "._", "getcon", "f_", "(_", "\\u", "mod_", ")_", ",_", "\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Config", "File_", "(_", "\\u", "file_", ")_", "._", "write_", "(_", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "Config", "File_", "(_", "\\u", "file_", ")_", "._", "write_", "(_", "\"%", "s", " ", "=", " ", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "\\u", "var_", ",_", "str_", "(_", "dop", "_", "._", "getcon", "f_", "(_", "\\u", "mod_", ")_", ")_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cnt_", "=_", "cnt_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "up", "\\u", "progress_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Signature mismatch in overriding method
ellmetha/django-machina/machina/apps/forum_conversation/views.py
[ { "content": "class BasePostFormView(FormView):\n \"\"\"\n A base view for handling post forms.\n \"\"\"\n post_form_class = PostForm\n attachment_formset_class = AttachmentFormset\n\n post_pk_url_kwarg = None\n topic_pk_url_kwarg = None\n forum_pk_url_kwarg = None\n\n success_message = _('This message has been posted successfully.')\n approval_required_message = _('This message will be validated before appearing on the forum.')\n attachment_formset_general_error_message = _(\n 'There are some errors in the attachments you submitted.')\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.BasePostFormView", "header": "['module', '___EOS___']", "index": 112 }, { "content": " def get(self, request, *args, **kwargs):\n self.init_attachment_cache()\n\n # Initializes the forms\n post_form_class = self.get_post_form_class()\n post_form = self.get_post_form(post_form_class)\n attachment_formset_class = self.get_attachment_formset_class()\n attachment_formset = self.get_attachment_formset(attachment_formset_class)\n\n return self.render_to_response(\n self.get_context_data(\n post_form=post_form,\n attachment_formset=attachment_formset))", "metadata": "root.BasePostFormView.get", "header": "['class', 'BasePostFormView', '(', 'FormView', ')', ':', '___EOS___']", "index": 128 }, { "content": " def post(self, request, *args, **kwargs):\n self.init_attachment_cache()\n\n # Stores a boolean indicating if we are considering a preview\n self.preview = 'preview' in self.request.POST\n\n # Initializes the forms\n post_form_class = self.get_post_form_class()\n post_form = self.get_post_form(post_form_class)\n attachment_formset_class = self.get_attachment_formset_class()\n attachment_formset = self.get_attachment_formset(attachment_formset_class)\n\n self.attachment_preview = self.preview if attachment_formset \\\n and attachment_formset.is_valid() else None\n\n post_form_valid = post_form.is_valid()\n if (post_form_valid and attachment_formset is None) or \\\n (post_form_valid and attachment_formset.is_valid()):\n return self.form_valid(post_form, attachment_formset)\n else:\n return self.form_invalid(post_form, attachment_formset)", "metadata": "root.BasePostFormView.post", "header": "['class', 'BasePostFormView', '(', 'FormView', ')', ':', '___EOS___']", "index": 142 }, { "content": " def init_attachment_cache(self):\n \"\"\"\n Initializes the attachment cache for the current view.\n \"\"\"\n if self.request.method == 'GET':\n # Invalidates previous attachments\n attachments_cache.delete(self.get_attachments_cache_key(self.request))\n return\n\n # Try to restore previous uploaded attachments if applicable\n attachments_cache_key = self.get_attachments_cache_key(self.request)\n restored_attachments_dict = attachments_cache.get(attachments_cache_key)\n if restored_attachments_dict:\n restored_attachments_dict.update(self.request.FILES)\n self.request._files = restored_attachments_dict\n\n # Updates the attachment cache if files are available\n if self.request.FILES:\n attachments_cache.set(attachments_cache_key, self.request.FILES)", "metadata": "root.BasePostFormView.init_attachment_cache", "header": "['class', 'BasePostFormView', '(', 'FormView', ')', ':', '___EOS___']", "index": 164 }, { "content": " def get_attachments_cache_key(self, request):\n \"\"\"\n Returns the key used to store attachment files states into the\n file based cache.\n \"\"\"\n return 'attachments_{}'.format(request.session.session_key)", "metadata": "root.BasePostFormView.get_attachments_cache_key", "header": "['class', 'BasePostFormView', '(', 'FormView', ')', ':', '___EOS___']", "index": 184 }, { "content": " def get_post_form_class(self):\n \"\"\"\n Returns the post form class to use for instantiating the form.\n \"\"\"\n return self.post_form_class", "metadata": "root.BasePostFormView.get_post_form_class", "header": "['class', 'BasePostFormView', '(', 'FormView', ')', ':', '___EOS___']", "index": 191 }, { "content": " def get_post_form(self, form_class):\n \"\"\"\n Returns an instance of the post form to be used in the view.\n \"\"\"\n return form_class(**self.get_post_form_kwargs())", "metadata": "root.BasePostFormView.get_post_form", "header": "['class', 'BasePostFormView', '(', 'FormView', ')', ':', '___EOS___']", "index": 197 }, { "content": " def get_post_form_kwargs(self):\n \"\"\"\n Returns the keyword arguments for instantiating the post form.\n \"\"\"\n kwargs = {\n 'user': self.request.user,\n 'user_ip': get_client_ip(self.request),\n 'forum': self.get_forum(),\n 'topic': self.get_topic(),\n }\n\n post = self.get_post()\n if post:\n kwargs.update({'instance': post})\n\n if self.request.method in ('POST', 'PUT'):\n kwargs.update({\n 'data': self.request.POST,\n 'files': self.request.FILES,\n })\n return kwargs", "metadata": "root.BasePostFormView.get_post_form_kwargs", "header": "['class', 'BasePostFormView', '(', 'FormView', ')', ':', '___EOS___']", "index": 203 }, { "content": " def get_attachment_formset_class(self):\n \"\"\"\n Returns the attachment formset class to use for instantiating the\n attachment formset.\n \"\"\"\n return self.attachment_formset_class", "metadata": "root.BasePostFormView.get_attachment_formset_class", "header": "['class', 'BasePostFormView', '(', 'FormView', ')', ':', '___EOS___']", "index": 225 }, { "content": " def get_attachment_formset(self, formset_class):\n \"\"\"\n Returns an instance of the attachment formset to be used in the view.\n \"\"\"\n if self.request.forum_permission_handler.can_attach_files(\n self.get_forum(), self.request.user):\n return formset_class(**self.get_attachment_formset_kwargs())", "metadata": "root.BasePostFormView.get_attachment_formset", "header": "['class', 'BasePostFormView', '(', 'FormView', ')', ':', '___EOS___']", "index": 232 }, { "content": " def get_attachment_formset_kwargs(self):\n \"\"\"\n Returns the keyword arguments for instantiating the attachment formset.\n \"\"\"\n kwargs = {\n 'prefix': 'attachment',\n }\n\n if self.request.method in ('POST', 'PUT'):\n kwargs.update({\n 'data': self.request.POST,\n 'files': self.request.FILES,\n })\n else:\n post = self.get_post()\n attachment_queryset = Attachment.objects.filter(post=post)\n kwargs.update({\n 'queryset': attachment_queryset,\n })\n return kwargs", "metadata": "root.BasePostFormView.get_attachment_formset_kwargs", "header": "['class', 'BasePostFormView', '(', 'FormView', ')', ':', '___EOS___']", "index": 240 }, { "content": " def get_context_data(self, **kwargs):\n context = kwargs\n if 'view' not in context:\n context['view'] = self\n\n # Insert the considered forum, topic and post into the context\n context['forum'] = self.get_forum()\n context['topic'] = self.get_topic()\n context['post'] = self.get_post()\n\n # Handles the preview of the attachments\n if context['attachment_formset']:\n if hasattr(self, 'attachment_preview') and self.attachment_preview:\n context['attachment_preview'] = self.attachment_preview\n attachments = []\n # Computes the list of the attachment file names that should be attached\n # to the forum post being created or updated\n for form in context['attachment_formset'].forms:\n if form['DELETE'].value() \\\n or (not form['file'].html_name in self.request._files and\n not form.instance.pk):\n continue\n attachments.append(\n (\n form,\n self.request._files[form['file'].html_name].name if not form.instance\n else form.instance.filename\n ))\n context['attachment_file_previews'] = attachments\n\n return context", "metadata": "root.BasePostFormView.get_context_data", "header": "['class', 'BasePostFormView', '(', 'FormView', ')', ':', '___EOS___']", "index": 261 }, { "content": " def get_forum(self):\n \"\"\"\n Returns the considered forum.\n \"\"\"\n pk = self.kwargs.get(self.forum_pk_url_kwarg, None)\n if not pk: # pragma: no cover\n # This should never happen\n return\n if not hasattr(self, '_forum'):\n self._forum = get_object_or_404(Forum, pk=pk)\n return self._forum", "metadata": "root.BasePostFormView.get_forum", "header": "['class', 'BasePostFormView', '(', 'FormView', ')', ':', '___EOS___']", "index": 293 }, { "content": " def get_topic(self):\n \"\"\"\n Returns the considered topic if applicable.\n \"\"\"\n pk = self.kwargs.get(self.topic_pk_url_kwarg, None)\n if not pk:\n return\n if not hasattr(self, '_topic'):\n self._topic = get_object_or_404(Topic, pk=pk)\n return self._topic", "metadata": "root.BasePostFormView.get_topic", "header": "['class', 'BasePostFormView', '(', 'FormView', ')', ':', '___EOS___']", "index": 305 }, { "content": " def get_post(self):\n \"\"\"\n Returns the considered post if applicable.\n \"\"\"\n pk = self.kwargs.get(self.post_pk_url_kwarg, None)\n if not pk:\n return\n if not hasattr(self, '_forum_post'):\n self._forum_post = get_object_or_404(Post, pk=pk)\n return self._forum_post", "metadata": "root.BasePostFormView.get_post", "header": "['class', 'BasePostFormView', '(', 'FormView', ')', ':', '___EOS___']", "index": 316 }, { "content": " def form_valid(self, post_form, attachment_formset, **kwargs):\n \"\"\"\n Called if all forms are valid. Creates a Post instance along with\n associated attachments if required and then redirects to a success\n page.\n \"\"\"\n save_attachment_formset = attachment_formset is not None \\\n and not self.preview\n\n if self.preview:\n return self.render_to_response(\n self.get_context_data(\n preview=True,\n post_form=post_form,\n attachment_formset=attachment_formset, **kwargs))\n\n # This is not a preview ; the object is going to be saved\n self.forum_post = post_form.save()\n\n if save_attachment_formset:\n attachment_formset.post = self.forum_post\n attachment_formset.save()\n\n messages.success(self.request, self.success_message)\n if not self.forum_post.approved:\n messages.warning(self.request, self.approval_required_message)\n\n return HttpResponseRedirect(self.get_success_url())", "metadata": "root.BasePostFormView.form_valid", "header": "['class', 'BasePostFormView', '(', 'FormView', ')', ':', '___EOS___']", "index": 327 }, { "content": " def form_invalid(self, post_form, attachment_formset, **kwargs):\n \"\"\"\n Called if one of the forms is invalid. Re-renders the context data with\n the data-filled forms and errors.\n \"\"\"\n if attachment_formset and not attachment_formset.is_valid() \\\n and len(attachment_formset.errors):\n messages.error(\n self.request, self.attachment_formset_general_error_message)\n\n return self.render_to_response(\n self.get_context_data(\n post_form=post_form,\n attachment_formset=attachment_formset, **kwargs))", "metadata": "root.BasePostFormView.form_invalid", "header": "['class', 'BasePostFormView', '(', 'FormView', ')', ':', '___EOS___']", "index": 356 }, { "content": "class BaseTopicFormView(BasePostFormView):\n \"\"\"\n A base view for handling topic forms.\n \"\"\"\n # A specific form class is used here in order to fill the Topic-related\n # date in addition to the ones related to Post instances.\n post_form_class = TopicForm\n\n poll_option_formset_class = TopicPollOptionFormset\n\n poll_option_formset_general_error_message = _(\n 'There are some errors in the poll options you submitted.')\n\n\n\n\n\n\n\n", "metadata": "root.BaseTopicFormView", "header": "['module', '___EOS___']", "index": 372 }, { "content": " def get(self, request, *args, **kwargs):\n self.init_attachment_cache()\n\n # Initializes the forms\n post_form_class = self.get_post_form_class()\n post_form = self.get_post_form(post_form_class)\n attachment_formset_class = self.get_attachment_formset_class()\n attachment_formset = self.get_attachment_formset(attachment_formset_class)\n poll_option_formset_class = self.get_poll_option_formset_class()\n poll_option_formset = self.get_poll_option_formset(poll_option_formset_class)\n\n return self.render_to_response(\n self.get_context_data(\n post_form=post_form,\n attachment_formset=attachment_formset,\n poll_option_formset=poll_option_formset))", "metadata": "root.BaseTopicFormView.get", "header": "['class', 'BaseTopicFormView', '(', 'BasePostFormView', ')', ':', '___EOS___']", "index": 385 }, { "content": " def post(self, request, *args, **kwargs):\n self.init_attachment_cache()\n\n # Stores a boolean indicating if we are considering a preview\n self.preview = 'preview' in self.request.POST\n\n # Initializes the forms\n post_form_class = self.get_post_form_class()\n post_form = self.get_post_form(post_form_class)\n attachment_formset_class = self.get_attachment_formset_class()\n attachment_formset = self.get_attachment_formset(attachment_formset_class)\n poll_option_formset_class = self.get_poll_option_formset_class()\n poll_option_formset = self.get_poll_option_formset(poll_option_formset_class)\n\n post_form_valid = post_form.is_valid()\n attachment_formset_valid = attachment_formset.is_valid() if attachment_formset \\\n else None\n poll_option_formset_valid = poll_option_formset.is_valid() if poll_option_formset \\\n and len(post_form.cleaned_data['poll_question']) else None\n\n self.attachment_preview = self.preview if attachment_formset_valid else None\n self.poll_preview = self.preview if poll_option_formset_valid else None\n\n poll_options_validated = poll_option_formset_valid is not None\n if post_form_valid and attachment_formset_valid is not False \\\n and poll_option_formset_valid is not False:\n return self.form_valid(\n post_form, attachment_formset, poll_option_formset,\n poll_options_validated=poll_options_validated)\n else:\n return self.form_invalid(\n post_form, attachment_formset, poll_option_formset,\n poll_options_validated=poll_options_validated)", "metadata": "root.BaseTopicFormView.post", "header": "['class', 'BaseTopicFormView', '(', 'BasePostFormView', ')', ':', '___EOS___']", "index": 402 }, { "content": " def get_poll_option_formset_class(self):\n \"\"\"\n Returns the poll option formset class to use for instantiating the\n poll option formset.\n \"\"\"\n return self.poll_option_formset_class", "metadata": "root.BaseTopicFormView.get_poll_option_formset_class", "header": "['class', 'BaseTopicFormView', '(', 'BasePostFormView', ')', ':', '___EOS___']", "index": 436 }, { "content": " def get_poll_option_formset(self, formset_class):\n \"\"\"\n Returns an instance of the poll option formset to be used in the view.\n \"\"\"\n if self.request.forum_permission_handler.can_create_polls(\n self.get_forum(), self.request.user):\n return formset_class(**self.get_poll_option_formset_kwargs())", "metadata": "root.BaseTopicFormView.get_poll_option_formset", "header": "['class', 'BaseTopicFormView', '(', 'BasePostFormView', ')', ':', '___EOS___']", "index": 443 }, { "content": " def get_poll_option_formset_kwargs(self):\n \"\"\"\n Returns the keyword arguments for instantiating the poll option formset.\n \"\"\"\n kwargs = {\n 'prefix': 'poll',\n }\n\n if self.request.method in ('POST', 'PUT'):\n kwargs.update({\n 'data': self.request.POST,\n 'files': self.request.FILES,\n })\n else:\n topic = self.get_topic()\n poll_option_queryset = TopicPollOption.objects.filter(poll__topic=topic)\n kwargs.update({\n 'queryset': poll_option_queryset,\n })\n return kwargs", "metadata": "root.BaseTopicFormView.get_poll_option_formset_kwargs", "header": "['class', 'BaseTopicFormView', '(', 'BasePostFormView', ')', ':', '___EOS___']", "index": 451 }, { "content": " def get_context_data(self, **kwargs):\n context = super(BaseTopicFormView, self).get_context_data(**kwargs)\n\n # Handles the preview of the poll\n if context['poll_option_formset']:\n if hasattr(self, 'poll_preview') and self.poll_preview:\n context['poll_preview'] = self.poll_preview\n context['poll_options_previews'] = filter(\n lambda f: f['text'].value() and not f['DELETE'].value(),\n context['poll_option_formset'].forms)\n\n return context", "metadata": "root.BaseTopicFormView.get_context_data", "header": "['class', 'BaseTopicFormView', '(', 'BasePostFormView', ')', ':', '___EOS___']", "index": 472 }, { "content": " def form_valid(self, post_form, attachment_formset, poll_option_formset, **kwargs):\n save_poll_option_formset = poll_option_formset is not None \\\n and not self.preview\n\n valid = super(BaseTopicFormView, self).form_valid(\n post_form, attachment_formset, poll_option_formset=poll_option_formset, **kwargs)\n\n if save_poll_option_formset:\n poll_option_formset.topic = self.forum_post.topic\n poll_option_formset.save(\n poll_question=post_form.cleaned_data.pop('poll_question', None),\n poll_max_options=post_form.cleaned_data.pop('poll_max_options', None),\n poll_duration=post_form.cleaned_data.pop('poll_duration', None),\n poll_user_changes=post_form.cleaned_data.pop('poll_user_changes', None),\n )\n\n return valid", "metadata": "root.BaseTopicFormView.form_valid", "header": "['class', 'BaseTopicFormView', '(', 'BasePostFormView', ')', ':', '___EOS___']", "index": 485 }, { "content": " def form_invalid(self, post_form, attachment_formset, poll_option_formset, **kwargs):\n poll_errors = [k for k in post_form.errors.keys() if k.startswith('poll_')]\n if poll_errors or (poll_option_formset and not poll_option_formset.is_valid() and\n len(post_form.cleaned_data['poll_question'])):\n messages.error(self.request, self.poll_option_formset_general_error_message)\n\n return super(BaseTopicFormView, self).form_invalid(\n post_form, attachment_formset, poll_option_formset=poll_option_formset, **kwargs)", "metadata": "root.BaseTopicFormView.form_invalid", "header": "['class', 'BaseTopicFormView', '(', 'BasePostFormView', ')', ':', '___EOS___']", "index": 503 } ]
[ { "span": "def form_valid(self, post_form, attachment_formset, poll_option_formset, **kwargs):", "start_line": 485, "start_column": 4, "end_line": 485, "end_column": 87 }, { "span": "def form_invalid(self, post_form, attachment_formset, poll_option_formset, **kwargs):", "start_line": 503, "start_column": 4, "end_line": 503, "end_column": 89 } ]
[ { "span": "def form_valid(self, post_form, attachment_formset, **kwargs):", "start_line": 327, "start_column": 4, "end_line": 327, "end_column": 66 }, { "span": "def form_invalid(self, post_form, attachment_formset, **kwargs):", "start_line": 356, "start_column": 4, "end_line": 356, "end_column": 68 } ]
1
false
[ "[CLS]_", "Signature_", "mismatch_", "in_", "overrid", "ing_", "method_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Base", "Post", "Form", "View_", "(_", "Form", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "base", " ", "view", " ", "for", " ", "handling", " ", "post", " ", "forms", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "form", "\\u", "class_", "=_", "Post", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attach", "ment", "\\u", "formset", "\\u", "class_", "=_", "Attach", "ment", "Form", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "pk", "\\u", "url", "\\u", "kwarg_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topic", "\\u", "pk", "\\u", "url", "\\u", "kwarg_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "forum", "\\u", "pk", "\\u", "url", "\\u", "kwarg_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "success", "\\u", "message_", "=_", "\\u_", "(_", "'", "Thi", "s", " ", "message", " ", "has", " ", "bee", "n", " ", "poste", "d", " ", "success", "full", "y", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "approval", "\\u", "require", "d\\u", "message_", "=_", "\\u_", "(_", "'", "Thi", "s", " ", "message", " ", "will", " ", "be", " ", "validat", "ed", " ", "bef", "ore", " ", "appear", "ing", " ", "on", " ", "the", " ", "forum", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attach", "ment", "\\u", "formset", "\\u", "genera", "l\\u", "error", "\\u", "message_", "=_", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "There", " ", "are", " ", "some", " ", "error", "s", " ", "in", " ", "the", " ", "attach", "ment", "s", " ", "you", " ", "submitted", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Base", "Post", "Form", "View_", "(_", "Form", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "init", "\\u", "attach", "ment", "\\u", "cache_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initializ", "es", " ", "the", " ", "forms_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "form", "\\u", "class_", "=_", "self_", "._", "get", "\\u", "post", "\\u", "form", "\\u", "class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "form_", "=_", "self_", "._", "get", "\\u", "post", "\\u", "form_", "(_", "post", "\\u", "form", "\\u", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attach", "ment", "\\u", "formset", "\\u", "class_", "=_", "self_", "._", "get", "\\u", "attach", "ment", "\\u", "formset", "\\u", "class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attach", "ment", "\\u", "formset_", "=_", "self_", "._", "get", "\\u", "attach", "ment", "\\u", "formset_", "(_", "attach", "ment", "\\u", "formset", "\\u", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "render", "\\u", "to", "\\u", "response_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "get", "\\u", "context", "\\u", "data_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "form_", "=_", "post", "\\u", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "attach", "ment", "\\u", "formset_", "=_", "attach", "ment", "\\u", "formset_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Post", "Form", "View_", "(_", "Form", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "init", "\\u", "attach", "ment", "\\u", "cache_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Stor", "es", " ", "a", " ", "boolean", " ", "indicati", "ng", " ", "if", " ", "we", " ", "are", " ", "consider", "ing", " ", "a", " ", "preview_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "preview_", "=_", "'", "previe", "w", "'_", "in_", "self_", "._", "request_", "._", "POST_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initializ", "es", " ", "the", " ", "forms_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "form", "\\u", "class_", "=_", "self_", "._", "get", "\\u", "post", "\\u", "form", "\\u", "class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "form_", "=_", "self_", "._", "get", "\\u", "post", "\\u", "form_", "(_", "post", "\\u", "form", "\\u", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attach", "ment", "\\u", "formset", "\\u", "class_", "=_", "self_", "._", "get", "\\u", "attach", "ment", "\\u", "formset", "\\u", "class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attach", "ment", "\\u", "formset_", "=_", "self_", "._", "get", "\\u", "attach", "ment", "\\u", "formset_", "(_", "attach", "ment", "\\u", "formset", "\\u", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "attach", "ment", "\\u", "preview_", "=_", "self_", "._", "preview_", "if_", "attach", "ment", "\\u", "formset_", "and_", "attach", "ment", "\\u", "formset_", "._", "is", "\\u", "valid_", "(_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "form", "\\u", "valid_", "=_", "post", "\\u", "form_", "._", "is", "\\u", "valid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "post", "\\u", "form", "\\u", "valid_", "and_", "attach", "ment", "\\u", "formset_", "is_", "None_", ")_", "or_", "(_", "post", "\\u", "form", "\\u", "valid_", "and_", "attach", "ment", "\\u", "formset_", "._", "is", "\\u", "valid_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "form", "\\u", "valid_", "(_", "post", "\\u", "form_", ",_", "attach", "ment", "\\u", "formset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "form", "\\u", "invalid_", "(_", "post", "\\u", "form_", ",_", "attach", "ment", "\\u", "formset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Post", "Form", "View_", "(_", "Form", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "\\u", "attach", "ment", "\\u", "cache_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Initializ", "es", " ", "the", " ", "attach", "ment", " ", "cache", " ", "for", " ", "the", " ", "current", " ", "view", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "request_", "._", "method_", "==_", "'", "GET", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Inva", "lida", "tes", " ", "previ", "ous", " ", "attachments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attach", "ment", "s", "\\u", "cache_", "._", "delete_", "(_", "self_", "._", "get", "\\u", "attach", "ment", "s", "\\u", "cache", "\\u", "key_", "(_", "self_", "._", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "restore", " ", "previ", "ous", " ", "uploade", "d", " ", "attach", "ment", "s", " ", "if", " ", "applica", "ble_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "attach", "ment", "s", "\\u", "cache", "\\u", "key_", "=_", "self_", "._", "get", "\\u", "attach", "ment", "s", "\\u", "cache", "\\u", "key_", "(_", "self_", "._", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "restore", "d\\u", "attach", "ment", "s", "\\u", "dict_", "=_", "attach", "ment", "s", "\\u", "cache_", "._", "get_", "(_", "attach", "ment", "s", "\\u", "cache", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "restore", "d\\u", "attach", "ment", "s", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "restore", "d\\u", "attach", "ment", "s", "\\u", "dict_", "._", "update_", "(_", "self_", "._", "request_", "._", "FILES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "request_", "._", "\\u", "files_", "=_", "restore", "d\\u", "attach", "ment", "s", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", "s", " ", "the", " ", "attach", "ment", " ", "cache", " ", "if", " ", "files", " ", "are", " ", "available_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "request_", "._", "FILES_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attach", "ment", "s", "\\u", "cache_", "._", "set_", "(_", "attach", "ment", "s", "\\u", "cache", "\\u", "key_", ",_", "self_", "._", "request_", "._", "FILES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Post", "Form", "View_", "(_", "Form", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "attach", "ment", "s", "\\u", "cache", "\\u", "key_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "key", " ", "used", " ", "to", " ", "store", " ", "attach", "ment", " ", "files", " ", "state", "s", " ", "int", "o", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "file", " ", "based", " ", "cache", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'", "attach", "ment", "s", "\\u{}'_", "._", "format_", "(_", "request_", "._", "session_", "._", "session", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Post", "Form", "View_", "(_", "Form", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "post", "\\u", "form", "\\u", "class_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "post", " ", "form", " ", "class", " ", "to", " ", "use", " ", "for", " ", "instant", "iati", "ng", " ", "the", " ", "form", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "post", "\\u", "form", "\\u", "class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Post", "Form", "View_", "(_", "Form", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "post", "\\u", "form_", "(_", "self_", ",_", "form", "\\u", "class_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "an", " ", "instance", " ", "of", " ", "the", " ", "post", " ", "form", " ", "to", " ", "be", " ", "used", " ", "in", " ", "the", " ", "view", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "form", "\\u", "class_", "(_", "**_", "self_", "._", "get", "\\u", "post", "\\u", "form", "\\u", "kwargs_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Post", "Form", "View_", "(_", "Form", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "post", "\\u", "form", "\\u", "kwargs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "for", " ", "instant", "iati", "ng", " ", "the", " ", "post", " ", "form", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "self_", "._", "request_", "._", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "ip", "'_", ":_", "get", "\\u", "client", "\\u", "ip_", "(_", "self_", "._", "request_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "forum", "'_", ":_", "self_", "._", "get", "\\u", "forum_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "topic", "'_", ":_", "self_", "._", "get", "\\u", "topic_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "post_", "=_", "self_", "._", "get", "\\u", "post_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "post_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "._", "update_", "(_", "{_", "'", "instance", "'_", ":_", "post_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "request_", "._", "method_", "in_", "(_", "'", "POST", "'_", ",_", "'", "PU", "T", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "self_", "._", "request_", "._", "POST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "files", "'_", ":_", "self_", "._", "request_", "._", "FILES_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "kwargs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Post", "Form", "View_", "(_", "Form", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "attach", "ment", "\\u", "formset", "\\u", "class_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "attach", "ment", " ", "formset", " ", "class", " ", "to", " ", "use", " ", "for", " ", "instant", "iati", "ng", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "attach", "ment", " ", "formset", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "attach", "ment", "\\u", "formset", "\\u", "class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Post", "Form", "View_", "(_", "Form", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "attach", "ment", "\\u", "formset_", "(_", "self_", ",_", "formset", "\\u", "class_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "an", " ", "instance", " ", "of", " ", "the", " ", "attach", "ment", " ", "formset", " ", "to", " ", "be", " ", "used", " ", "in", " ", "the", " ", "view", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "request_", "._", "forum", "\\u", "permissi", "on", "\\u", "handler_", "._", "can", "\\u", "attach", "\\u", "files_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "get", "\\u", "forum_", "(_", ")_", ",_", "self_", "._", "request_", "._", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "formset", "\\u", "class_", "(_", "**_", "self_", "._", "get", "\\u", "attach", "ment", "\\u", "formset", "\\u", "kwargs_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Post", "Form", "View_", "(_", "Form", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "attach", "ment", "\\u", "formset", "\\u", "kwargs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "for", " ", "instant", "iati", "ng", " ", "the", " ", "attach", "ment", " ", "formset", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "prefix", "'_", ":_", "'", "attach", "ment", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "request_", "._", "method_", "in_", "(_", "'", "POST", "'_", ",_", "'", "PU", "T", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "self_", "._", "request_", "._", "POST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "files", "'_", ":_", "self_", "._", "request_", "._", "FILES_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "post_", "=_", "self_", "._", "get", "\\u", "post_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attach", "ment", "\\u", "queryset_", "=_", "Attachment_", "._", "objects_", "._", "filter_", "(_", "post_", "=_", "post_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "querys", "et", "'_", ":_", "attach", "ment", "\\u", "queryset_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "kwargs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Post", "Form", "View_", "(_", "Form", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "context", "\\u", "data_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "kwargs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "view", "'_", "not_", "in_", "context_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "[_", "'", "view", "'_", "]_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Insert", " ", "the", " ", "consider", "ed", " ", "forum", ",", " ", "topic", " ", "and", " ", "post", " ", "int", "o", " ", "the", " ", "context_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "[_", "'", "forum", "'_", "]_", "=_", "self_", "._", "get", "\\u", "forum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "'", "topic", "'_", "]_", "=_", "self_", "._", "get", "\\u", "topic_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "'", "post", "'_", "]_", "=_", "self_", "._", "get", "\\u", "post_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Handle", "s", " ", "the", " ", "previe", "w", " ", "of", " ", "the", " ", "attachments_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "context_", "[_", "'", "attach", "ment", "\\u", "formset", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "self_", ",_", "'", "attach", "ment", "\\u", "previe", "w", "'_", ")_", "and_", "self_", "._", "attach", "ment", "\\u", "preview_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "[_", "'", "attach", "ment", "\\u", "previe", "w", "'_", "]_", "=_", "self_", "._", "attach", "ment", "\\u", "preview_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attachments_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Compute", "s", " ", "the", " ", "list", " ", "of", " ", "the", " ", "attach", "ment", " ", "file", " ", "names", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "attache", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "the", " ", "forum", " ", "post", " ", "bei", "ng", " ", "created", " ", "or", " ", "updated_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "form_", "in_", "context_", "[_", "'", "attach", "ment", "\\u", "formset", "'_", "]_", "._", "forms_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "form_", "[_", "'", "DELET", "E", "'_", "]_", "._", "value_", "(_", ")_", "or_", "(_", "not_", "form_", "[_", "'", "file", "'_", "]_", "._", "html", "\\u", "name_", "in_", "self_", "._", "request_", "._", "\\u", "files_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "form_", "._", "instance_", "._", "pk_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "attachments_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "request_", "._", "\\u", "files_", "[_", "form_", "[_", "'", "file", "'_", "]_", "._", "html", "\\u", "name_", "]_", "._", "name_", "if_", "not_", "form_", "._", "instance_", "\\u\\u\\uNL\\u\\u\\u_", "else_", "form_", "._", "instance_", "._", "filename_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "[_", "'", "attach", "ment", "\\u", "file", "\\u", "previe", "ws", "'_", "]_", "=_", "attachments_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Post", "Form", "View_", "(_", "Form", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "forum_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "consider", "ed", " ", "forum", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pk_", "=_", "self_", "._", "kwargs_", "._", "get_", "(_", "self_", "._", "forum", "\\u", "pk", "\\u", "url", "\\u", "kwarg_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "pk_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "shou", "ld", " ", "neve", "r", " ", "happ", "en_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "self_", ",_", "'\\u", "forum", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "forum_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "For", "um_", ",_", "pk_", "=_", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "forum_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Post", "Form", "View_", "(_", "Form", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "topic_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "consider", "ed", " ", "topic", " ", "if", " ", "applica", "ble", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pk_", "=_", "self_", "._", "kwargs_", "._", "get_", "(_", "self_", "._", "topic", "\\u", "pk", "\\u", "url", "\\u", "kwarg_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "pk_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "self_", ",_", "'\\u", "topic", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "topic_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Topic_", ",_", "pk_", "=_", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "topic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Post", "Form", "View_", "(_", "Form", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "consider", "ed", " ", "post", " ", "if", " ", "applica", "ble", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pk_", "=_", "self_", "._", "kwargs_", "._", "get_", "(_", "self_", "._", "post", "\\u", "pk", "\\u", "url", "\\u", "kwarg_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "pk_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "self_", ",_", "'\\u", "forum", "\\u", "post", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "forum", "\\u", "post_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Post_", ",_", "pk_", "=_", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "forum", "\\u", "post_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Post", "Form", "View_", "(_", "Form", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "form", "\\u", "valid_", "(_", "self_", ",_", "post", "\\u", "form_", ",_", "attach", "ment", "\\u", "formset_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Call", "ed", " ", "if", " ", "all", " ", "forms", " ", "are", " ", "valid", ".", " ", "Creat", "es", " ", "a", " ", "Post", " ", "instance", " ", "along", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "associate", "d", " ", "attach", "ment", "s", " ", "if", " ", "require", "d", " ", "and", " ", "then", " ", "redirec", "ts", " ", "to", " ", "a", " ", "success", "\\", "10", ";", " ", " ", " ", " ", "page", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "\\u", "attach", "ment", "\\u", "formset_", "=_", "attach", "ment", "\\u", "formset_", "is_", "not_", "None_", "and_", "not_", "self_", "._", "preview_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "preview_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "render", "\\u", "to", "\\u", "response_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "get", "\\u", "context", "\\u", "data_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "preview_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "form_", "=_", "post", "\\u", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "attach", "ment", "\\u", "formset_", "=_", "attach", "ment", "\\u", "formset_", ",_", "**_", "kwargs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "not", " ", "a", " ", "previe", "w", " ", ";", " ", "the", " ", "object", " ", "is", " ", "goi", "ng", " ", "to", " ", "be", " ", "saved_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "forum", "\\u", "post_", "=_", "post", "\\u", "form_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "save", "\\u", "attach", "ment", "\\u", "formset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attach", "ment", "\\u", "formset_", "._", "post_", "=_", "self_", "._", "forum", "\\u", "post_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attach", "ment", "\\u", "formset_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "messages_", "._", "success_", "(_", "self_", "._", "request_", ",_", "self_", "._", "success", "\\u", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "forum", "\\u", "post_", "._", "approved", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "messages_", "._", "warning_", "(_", "self_", "._", "request_", ",_", "self_", "._", "approval", "\\u", "require", "d\\u", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "self_", "._", "get", "\\u", "success", "\\u", "url_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Post", "Form", "View_", "(_", "Form", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "form", "\\u", "invalid_", "(_", "self_", ",_", "post", "\\u", "form_", ",_", "attach", "ment", "\\u", "formset_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Call", "ed", " ", "if", " ", "one", " ", "of", " ", "the", " ", "forms", " ", "is", " ", "invalid", ".", " ", "Re", "-", "render", "s", " ", "the", " ", "context", " ", "data", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "data", "-", "filled", " ", "forms", " ", "and", " ", "error", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "attach", "ment", "\\u", "formset_", "and_", "not_", "attach", "ment", "\\u", "formset_", "._", "is", "\\u", "valid_", "(_", ")_", "and_", "len_", "(_", "attach", "ment", "\\u", "formset_", "._", "errors_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "messages_", "._", "error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "request_", ",_", "self_", "._", "attach", "ment", "\\u", "formset", "\\u", "genera", "l\\u", "error", "\\u", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "render", "\\u", "to", "\\u", "response_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "get", "\\u", "context", "\\u", "data_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "form_", "=_", "post", "\\u", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "attach", "ment", "\\u", "formset_", "=_", "attach", "ment", "\\u", "formset_", ",_", "**_", "kwargs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Base", "Topic", "Form", "View_", "(_", "Base", "Post", "Form", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "base", " ", "view", " ", "for", " ", "handling", " ", "topic", " ", "forms", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "A", " ", "specific", " ", "form", " ", "class", " ", "is", " ", "used", " ", "here", " ", "in", " ", "order", " ", "to", " ", "fill", " ", "the", " ", "Topic", "-", "related_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "date", " ", "in", " ", "addition", " ", "to", " ", "the", " ", "ones", " ", "relate", "d", " ", "to", " ", "Post", " ", "instance", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "form", "\\u", "class_", "=_", "Topic", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poll", "\\u", "option", "\\u", "formset", "\\u", "class_", "=_", "Topic", "Poll", "Optio", "n", "Form", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poll", "\\u", "option", "\\u", "formset", "\\u", "genera", "l\\u", "error", "\\u", "message_", "=_", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "There", " ", "are", " ", "some", " ", "error", "s", " ", "in", " ", "the", " ", "poll", " ", "options", " ", "you", " ", "submitted", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Base", "Topic", "Form", "View_", "(_", "Base", "Post", "Form", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "init", "\\u", "attach", "ment", "\\u", "cache_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initializ", "es", " ", "the", " ", "forms_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "form", "\\u", "class_", "=_", "self_", "._", "get", "\\u", "post", "\\u", "form", "\\u", "class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "form_", "=_", "self_", "._", "get", "\\u", "post", "\\u", "form_", "(_", "post", "\\u", "form", "\\u", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attach", "ment", "\\u", "formset", "\\u", "class_", "=_", "self_", "._", "get", "\\u", "attach", "ment", "\\u", "formset", "\\u", "class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attach", "ment", "\\u", "formset_", "=_", "self_", "._", "get", "\\u", "attach", "ment", "\\u", "formset_", "(_", "attach", "ment", "\\u", "formset", "\\u", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll", "\\u", "option", "\\u", "formset", "\\u", "class_", "=_", "self_", "._", "get", "\\u", "poll", "\\u", "option", "\\u", "formset", "\\u", "class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll", "\\u", "option", "\\u", "formset_", "=_", "self_", "._", "get", "\\u", "poll", "\\u", "option", "\\u", "formset_", "(_", "poll", "\\u", "option", "\\u", "formset", "\\u", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "render", "\\u", "to", "\\u", "response_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "get", "\\u", "context", "\\u", "data_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "form_", "=_", "post", "\\u", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "attach", "ment", "\\u", "formset_", "=_", "attach", "ment", "\\u", "formset_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "poll", "\\u", "option", "\\u", "formset_", "=_", "poll", "\\u", "option", "\\u", "formset_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Topic", "Form", "View_", "(_", "Base", "Post", "Form", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "init", "\\u", "attach", "ment", "\\u", "cache_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Stor", "es", " ", "a", " ", "boolean", " ", "indicati", "ng", " ", "if", " ", "we", " ", "are", " ", "consider", "ing", " ", "a", " ", "preview_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "preview_", "=_", "'", "previe", "w", "'_", "in_", "self_", "._", "request_", "._", "POST_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initializ", "es", " ", "the", " ", "forms_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "form", "\\u", "class_", "=_", "self_", "._", "get", "\\u", "post", "\\u", "form", "\\u", "class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "form_", "=_", "self_", "._", "get", "\\u", "post", "\\u", "form_", "(_", "post", "\\u", "form", "\\u", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attach", "ment", "\\u", "formset", "\\u", "class_", "=_", "self_", "._", "get", "\\u", "attach", "ment", "\\u", "formset", "\\u", "class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attach", "ment", "\\u", "formset_", "=_", "self_", "._", "get", "\\u", "attach", "ment", "\\u", "formset_", "(_", "attach", "ment", "\\u", "formset", "\\u", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll", "\\u", "option", "\\u", "formset", "\\u", "class_", "=_", "self_", "._", "get", "\\u", "poll", "\\u", "option", "\\u", "formset", "\\u", "class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll", "\\u", "option", "\\u", "formset_", "=_", "self_", "._", "get", "\\u", "poll", "\\u", "option", "\\u", "formset_", "(_", "poll", "\\u", "option", "\\u", "formset", "\\u", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "form", "\\u", "valid_", "=_", "post", "\\u", "form_", "._", "is", "\\u", "valid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attach", "ment", "\\u", "formset", "\\u", "valid_", "=_", "attach", "ment", "\\u", "formset_", "._", "is", "\\u", "valid_", "(_", ")_", "if_", "attach", "ment", "\\u", "formset_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll", "\\u", "option", "\\u", "formset", "\\u", "valid_", "=_", "poll", "\\u", "option", "\\u", "formset_", "._", "is", "\\u", "valid_", "(_", ")_", "if_", "poll", "\\u", "option", "\\u", "formset_", "and_", "len_", "(_", "post", "\\u", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "poll", "\\u", "question", "'_", "]_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "attach", "ment", "\\u", "preview_", "=_", "self_", "._", "preview_", "if_", "attach", "ment", "\\u", "formset", "\\u", "valid_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "poll", "\\u", "preview_", "=_", "self_", "._", "preview_", "if_", "poll", "\\u", "option", "\\u", "formset", "\\u", "valid_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poll", "\\u", "options", "\\u", "validated_", "=_", "poll", "\\u", "option", "\\u", "formset", "\\u", "valid_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "post", "\\u", "form", "\\u", "valid_", "and_", "attach", "ment", "\\u", "formset", "\\u", "valid_", "is_", "not_", "False_", "and_", "poll", "\\u", "option", "\\u", "formset", "\\u", "valid_", "is_", "not_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "form", "\\u", "valid_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "form_", ",_", "attach", "ment", "\\u", "formset_", ",_", "poll", "\\u", "option", "\\u", "formset_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "poll", "\\u", "options", "\\u", "validated_", "=_", "poll", "\\u", "options", "\\u", "validated_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "form", "\\u", "invalid_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "form_", ",_", "attach", "ment", "\\u", "formset_", ",_", "poll", "\\u", "option", "\\u", "formset_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "poll", "\\u", "options", "\\u", "validated_", "=_", "poll", "\\u", "options", "\\u", "validated_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Topic", "Form", "View_", "(_", "Base", "Post", "Form", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "poll", "\\u", "option", "\\u", "formset", "\\u", "class_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "poll", " ", "option", " ", "formset", " ", "class", " ", "to", " ", "use", " ", "for", " ", "instant", "iati", "ng", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "poll", " ", "option", " ", "formset", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "poll", "\\u", "option", "\\u", "formset", "\\u", "class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Topic", "Form", "View_", "(_", "Base", "Post", "Form", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "poll", "\\u", "option", "\\u", "formset_", "(_", "self_", ",_", "formset", "\\u", "class_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "an", " ", "instance", " ", "of", " ", "the", " ", "poll", " ", "option", " ", "formset", " ", "to", " ", "be", " ", "used", " ", "in", " ", "the", " ", "view", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "request_", "._", "forum", "\\u", "permissi", "on", "\\u", "handler_", "._", "can", "\\u", "create", "\\u", "polls", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "get", "\\u", "forum_", "(_", ")_", ",_", "self_", "._", "request_", "._", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "formset", "\\u", "class_", "(_", "**_", "self_", "._", "get", "\\u", "poll", "\\u", "option", "\\u", "formset", "\\u", "kwargs_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Topic", "Form", "View_", "(_", "Base", "Post", "Form", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "poll", "\\u", "option", "\\u", "formset", "\\u", "kwargs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "for", " ", "instant", "iati", "ng", " ", "the", " ", "poll", " ", "option", " ", "formset", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "prefix", "'_", ":_", "'", "poll", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "request_", "._", "method_", "in_", "(_", "'", "POST", "'_", ",_", "'", "PU", "T", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "self_", "._", "request_", "._", "POST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "files", "'_", ":_", "self_", "._", "request_", "._", "FILES_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "topic_", "=_", "self_", "._", "get", "\\u", "topic_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll", "\\u", "option", "\\u", "queryset_", "=_", "Topic", "Poll", "Option_", "._", "objects_", "._", "filter_", "(_", "poll", "\\u\\u", "topic_", "=_", "topic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "querys", "et", "'_", ":_", "poll", "\\u", "option", "\\u", "queryset_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "kwargs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Topic", "Form", "View_", "(_", "Base", "Post", "Form", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "context", "\\u", "data_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "super_", "(_", "Base", "Topic", "Form", "View_", ",_", "self_", ")_", "._", "get", "\\u", "context", "\\u", "data_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Handle", "s", " ", "the", " ", "previe", "w", " ", "of", " ", "the", " ", "poll_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "context_", "[_", "'", "poll", "\\u", "option", "\\u", "formset", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "self_", ",_", "'", "poll", "\\u", "previe", "w", "'_", ")_", "and_", "self_", "._", "poll", "\\u", "preview_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "[_", "'", "poll", "\\u", "previe", "w", "'_", "]_", "=_", "self_", "._", "poll", "\\u", "preview_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "'", "poll", "\\u", "options", "\\u", "previe", "ws", "'_", "]_", "=_", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "lambda_", "f_", ":_", "f_", "[_", "'", "text", "'_", "]_", "._", "value_", "(_", ")_", "and_", "not_", "f_", "[_", "'", "DELET", "E", "'_", "]_", "._", "value_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "[_", "'", "poll", "\\u", "option", "\\u", "formset", "'_", "]_", "._", "forms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Topic", "Form", "View_", "(_", "Base", "Post", "Form", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "form", "\\u", "valid_", "(_", "self_", ",_", "post", "\\u", "form_", ",_", "attach", "ment", "\\u", "formset_", ",_", "poll", "\\u", "option", "\\u", "formset_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "save", "\\u", "poll", "\\u", "option", "\\u", "formset_", "=_", "poll", "\\u", "option", "\\u", "formset_", "is_", "not_", "None_", "and_", "not_", "self_", "._", "preview_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "valid_", "=_", "super_", "(_", "Base", "Topic", "Form", "View_", ",_", "self_", ")_", "._", "form", "\\u", "valid_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "form_", ",_", "attach", "ment", "\\u", "formset_", ",_", "poll", "\\u", "option", "\\u", "formset_", "=_", "poll", "\\u", "option", "\\u", "formset_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "save", "\\u", "poll", "\\u", "option", "\\u", "formset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poll", "\\u", "option", "\\u", "formset_", "._", "topic_", "=_", "self_", "._", "forum", "\\u", "post_", "._", "topic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll", "\\u", "option", "\\u", "formset_", "._", "save_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "poll", "\\u", "question_", "=_", "post", "\\u", "form_", "._", "clean", "ed", "\\u", "data_", "._", "pop_", "(_", "'", "poll", "\\u", "question", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "poll", "\\u", "max", "\\u", "options_", "=_", "post", "\\u", "form_", "._", "clean", "ed", "\\u", "data_", "._", "pop_", "(_", "'", "poll", "\\u", "max", "\\u", "options", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "poll", "\\u", "duration_", "=_", "post", "\\u", "form_", "._", "clean", "ed", "\\u", "data_", "._", "pop_", "(_", "'", "poll", "\\u", "duration", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "poll", "\\u", "user", "\\u", "changes_", "=_", "post", "\\u", "form_", "._", "clean", "ed", "\\u", "data_", "._", "pop_", "(_", "'", "poll", "\\u", "user", "\\u", "change", "s", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "valid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Topic", "Form", "View_", "(_", "Base", "Post", "Form", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "form", "\\u", "invalid_", "(_", "self_", ",_", "post", "\\u", "form_", ",_", "attach", "ment", "\\u", "formset_", ",_", "poll", "\\u", "option", "\\u", "formset_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poll", "\\u", "errors_", "=_", "[_", "k_", "for_", "k_", "in_", "post", "\\u", "form_", "._", "errors_", "._", "keys_", "(_", ")_", "if_", "k_", "._", "startswith_", "(_", "'", "poll", "\\u'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "poll", "\\u", "errors_", "or_", "(_", "poll", "\\u", "option", "\\u", "formset_", "and_", "not_", "poll", "\\u", "option", "\\u", "formset_", "._", "is", "\\u", "valid_", "(_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "post", "\\u", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "poll", "\\u", "question", "'_", "]_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "messages_", "._", "error_", "(_", "self_", "._", "request_", ",_", "self_", "._", "poll", "\\u", "option", "\\u", "formset", "\\u", "genera", "l\\u", "error", "\\u", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Base", "Topic", "Form", "View_", ",_", "self_", ")_", "._", "form", "\\u", "invalid_", "(_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
tweetdeck/txAMQP/src/examples/thrift/client.py
[ { "content": "#!/usr/bin/env python\n\n# based on the 'calculator' demo in the Thrift source\n\nimport sys, os.path\nsys.path.insert(0, os.path.join(os.path.abspath(os.path.split(sys.argv[0])[0]), 'gen-py'))\nimport tutorial.Calculator\nfrom tutorial.ttypes import *\nfrom thrift.transport import TTwisted, TTransport\nfrom thrift.protocol import TBinaryProtocol\n\nfrom twisted.internet import reactor, defer\nfrom twisted.internet.protocol import ClientCreator\n\nimport txamqp.spec\nfrom txamqp.client import TwistedDelegate\nfrom txamqp.contrib.thrift.transport import TwistedAMQPTransport\nfrom txamqp.contrib.thrift.protocol import ThriftAMQClient\n\nservicesExchange = \"services\"\nresponsesExchange = \"responses\"\ncalculatorQueue = \"calculator_pool\"\ncalculatorKey = \"calculator\"\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n import sys\n if len(sys.argv) != 7:\n print \"%s host port vhost username password path_to_spec\" % sys.argv[0]\n sys.exit(1)\n\n host = sys.argv[1]\n port = int(sys.argv[2])\n vhost = sys.argv[3]\n username = sys.argv[4]\n password = sys.argv[5]\n specFile = sys.argv[6]\n\n spec = txamqp.spec.load(specFile)\n\n delegate = TwistedDelegate()\n\n d = ClientCreator(reactor, ThriftAMQClient, delegate, vhost,\n spec).connectTCP(host, port)\n d.addCallback(prepareClient, username, password).addCallback(gotClient)\n reactor.run()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def gotPing(_):\n print \"Ping received\"", "metadata": "root.gotPing", "header": "['module', '___EOS___']", "index": 24 }, { "content": "def gotAddResults(results):\n print \"Got results to add()\"\n print results", "metadata": "root.gotAddResults", "header": "['module', '___EOS___']", "index": 27 }, { "content": "def gotCalculateResults(results):\n print \"Got results to calculate()\"\n print results", "metadata": "root.gotCalculateResults", "header": "['module', '___EOS___']", "index": 31 }, { "content": "def gotCalculateErrors(error):\n error.trap(InvalidOperation)\n print \"Got a calculator error\"\n print error.value.why", "metadata": "root.gotCalculateErrors", "header": "['module', '___EOS___']", "index": 35 }, { "content": "def gotTransportError(error):\n error.trap(TTransport.TTransportException)\n print \"Got an AMQP unroutable message error:\"\n print error.value.message", "metadata": "root.gotTransportError", "header": "['module', '___EOS___']", "index": 40 }, { "content": "@defer.inlineCallbacks\ndef prepareClient(client, username, password):\n yield client.authenticate(username, password)\n\n channel = yield client.channel(1)\n\n yield channel.channel_open()\n yield channel.exchange_declare(exchange=servicesExchange, type=\"direct\")\n yield channel.exchange_declare(exchange=responsesExchange, type=\"direct\")\n\n pfactory = TBinaryProtocol.TBinaryProtocolFactory()\n\n # To trigger an unroutable message error (caught in the above\n # gotTransportError errback), change the routing key (i.e.,\n # calculatorKey) in the following to be something invalid, like\n # calculatorKey + 'xxx'.\n thriftClient = yield client.createThriftClient(responsesExchange,\n servicesExchange, calculatorKey, tutorial.Calculator.Client,\n iprot_factory=pfactory, oprot_factory=pfactory)\n \n defer.returnValue(thriftClient)", "metadata": "root.prepareClient", "header": "['module', '___EOS___']", "index": 45 }, { "content": "def gotClient(client):\n d1 = client.ping().addCallback(gotPing).addErrback(gotTransportError)\n\n d2 = client.add(1, 2).addCallback(gotAddResults).addErrback(gotTransportError)\n\n w = Work(num1=2, num2=3, op=Operation.ADD)\n\n d3 = client.calculate(1, w).addCallbacks(gotCalculateResults,\n gotCalculateErrors).addErrback(gotTransportError)\n\n w = Work(num1=2, num2=3, op=Operation.SUBTRACT)\n\n d4 = client.calculate(2, w).addCallbacks(gotCalculateResults,\n gotCalculateErrors).addErrback(gotTransportError)\n\n w = Work(num1=2, num2=3, op=Operation.MULTIPLY)\n\n d5 = client.calculate(3, w).addCallbacks(gotCalculateResults,\n gotCalculateErrors).addErrback(gotTransportError)\n\n w = Work(num1=2, num2=3, op=Operation.DIVIDE)\n\n d6 = client.calculate(4, w).addCallbacks(gotCalculateResults,\n gotCalculateErrors).addErrback(gotTransportError)\n\n # This will fire an errback\n w = Work(num1=2, num2=0, op=Operation.DIVIDE)\n\n d7 = client.calculate(5, w).addCallbacks(gotCalculateResults,\n gotCalculateErrors).addErrback(gotTransportError)\n\n d8 = client.zip()\n\n dl = defer.DeferredList([d1, d2, d3, d4, d5, d6, d7, d8])\n\n dl.addCallback(lambda _: reactor.stop())", "metadata": "root.gotClient", "header": "['module', '___EOS___']", "index": 67 } ]
[ { "span": "from thrift.transport import TTwisted, TTransport", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 49 }, { "span": "from txamqp.contrib.thrift.transport import TwistedAMQPTransport", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 64 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "based", " ", "on", " ", "the", " ", "'", "calculator", "'", " ", "demo", " ", "in", " ", "the", " ", "Thri", "ft", " ", "source_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", ",_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "split_", "(_", "sys_", "._", "argv_", "[_", "0_", "]_", ")_", "[_", "0_", "]_", ")_", ",_", "'", "gen", "-", "py", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tutorial", "_", "._", "Calculator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tutorial", "_", "._", "ttype", "s_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "thrift", "_", "._", "transport_", "import_", "TT", "wis", "ted_", ",_", "TT", "rans", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "thrift", "_", "._", "protocol_", "import_", "TB", "inary", "Protocol_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "twisted_", "._", "internet_", "import_", "reactor_", ",_", "defer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "internet_", "._", "protocol_", "import_", "Client", "Creator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "tx", "amqp", "_", "._", "spec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tx", "amqp", "_", "._", "client_", "import_", "Twi", "sted", "Delegate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tx", "amqp", "_", "._", "contrib_", "._", "thrift", "_", "._", "transport_", "import_", "Twi", "sted", "AMQ", "PT", "rans", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tx", "amqp", "_", "._", "contrib_", "._", "thrift", "_", "._", "protocol_", "import_", "Thri", "ft", "AMQ", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "service", "s", "Exchange_", "=_", "\"", "service", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "s", "Exchange_", "=_", "\"", "response", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "calculator", "Queue_", "=_", "\"", "calculator", "\\u", "pool", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "calculator", "Key_", "=_", "\"", "calculator", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "sys_", "._", "argv_", ")_", "!=_", "7_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"%", "s", " ", "host", " ", "port", " ", "vhost", " ", "user", "name", " ", "password", " ", "path", "\\u", "to", "\\u", "spec", "\"_", "%_", "sys_", "._", "argv_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "host_", "=_", "sys_", "._", "argv_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "int_", "(_", "sys_", "._", "argv_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vhost", "_", "=_", "sys_", "._", "argv_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "username_", "=_", "sys_", "._", "argv_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "sys_", "._", "argv_", "[_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spec", "File_", "=_", "sys_", "._", "argv_", "[_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", "=_", "tx", "amqp", "_", "._", "spec_", "._", "load_", "(_", "spec", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "delegate_", "=_", "Twi", "sted", "Delegate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Client", "Creator_", "(_", "reactor_", ",_", "Thri", "ft", "AMQ", "Client_", ",_", "delegate_", ",_", "vhost", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", ")_", "._", "connect", "TCP_", "(_", "host_", ",_", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "prepar", "e", "Client_", ",_", "username_", ",_", "password_", ")_", "._", "add", "Callback_", "(_", "got", "Client_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reactor_", "._", "run_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "got", "Ping", "_", "(_", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Ping", " ", "receive", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "got", "Add", "Results_", "(_", "results_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Got", " ", "results", " ", "to", " ", "add", "()\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "got", "Calculat", "e", "Results_", "(_", "results_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Got", " ", "results", " ", "to", " ", "calcul", "ate", "()\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "got", "Calculat", "e", "Errors_", "(_", "error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "._", "trap_", "(_", "Inva", "lid", "Operation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Got", " ", "a", " ", "calculator", " ", "error", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "error_", "._", "value_", "._", "why_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "got", "Transp", "ort", "Error_", "(_", "error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "._", "trap_", "(_", "TT", "rans", "port_", "._", "TT", "rans", "port", "Exception_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Got", " ", "an", " ", "AMQ", "P", " ", "unr", "out", "able", " ", "message", " ", "error", ":\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "error_", "._", "value_", "._", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "prepar", "e", "Client_", "(_", "client_", ",_", "username_", ",_", "password_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "client_", "._", "authenticate_", "(_", "username_", ",_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "channel_", "=_", "yield_", "client_", "._", "channel_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "channel_", "._", "channel", "\\u", "open_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "channel_", "._", "exchange", "\\u", "declare_", "(_", "exchange_", "=_", "service", "s", "Exchange_", ",_", "type_", "=_", "\"", "direct", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "channel_", "._", "exchange", "\\u", "declare_", "(_", "exchange_", "=_", "response", "s", "Exchange_", ",_", "type_", "=_", "\"", "direct", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pfa", "ctor", "y_", "=_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "To", " ", "trigger", " ", "an", " ", "unr", "out", "able", " ", "message", " ", "error", " ", "(", "cau", "ght", " ", "in", " ", "the", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "got", "Transp", "ort", "Error", " ", "errback", "),", " ", "change", " ", "the", " ", "routin", "g", " ", "key", " ", "(", "i", ".", "e", ".,", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "calculator", "Key", ")", " ", "in", " ", "the", " ", "follow", "ing", " ", "to", " ", "be", " ", "somet", "hing", " ", "invalid", ",", " ", "like_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "calculator", "Key", " ", "+", " ", "'", "xxx", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "thrift", "Client_", "=_", "yield_", "client_", "._", "create", "Thri", "ft", "Client_", "(_", "response", "s", "Exchange_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "service", "s", "Exchange_", ",_", "calculator", "Key_", ",_", "tutorial", "_", "._", "Calculator_", "._", "Client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ipr", "ot", "\\u", "factory_", "=_", "pfa", "ctor", "y_", ",_", "opr", "ot", "\\u", "factory_", "=_", "pfa", "ctor", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "defer_", "._", "return", "Value_", "(_", "thrift", "Client_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "got", "Client_", "(_", "client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d1_", "=_", "client_", "._", "ping_", "(_", ")_", "._", "add", "Callback_", "(_", "got", "Ping", "_", ")_", "._", "add", "Errback_", "(_", "got", "Transp", "ort", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d2_", "=_", "client_", "._", "add_", "(_", "1_", ",_", "2_", ")_", "._", "add", "Callback_", "(_", "got", "Add", "Results_", ")_", "._", "add", "Errback_", "(_", "got", "Transp", "ort", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "w_", "=_", "Work", "_", "(_", "num1_", "=_", "2_", ",_", "num2_", "=_", "3_", ",_", "op_", "=_", "Operation_", "._", "ADD_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d3_", "=_", "client_", "._", "calculate_", "(_", "1_", ",_", "w_", ")_", "._", "add", "Callbacks_", "(_", "got", "Calculat", "e", "Results_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "got", "Calculat", "e", "Errors_", ")_", "._", "add", "Errback_", "(_", "got", "Transp", "ort", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "w_", "=_", "Work", "_", "(_", "num1_", "=_", "2_", ",_", "num2_", "=_", "3_", ",_", "op_", "=_", "Operation_", "._", "SUBT", "RAC", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d4", "_", "=_", "client_", "._", "calculate_", "(_", "2_", ",_", "w_", ")_", "._", "add", "Callbacks_", "(_", "got", "Calculat", "e", "Results_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "got", "Calculat", "e", "Errors_", ")_", "._", "add", "Errback_", "(_", "got", "Transp", "ort", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "w_", "=_", "Work", "_", "(_", "num1_", "=_", "2_", ",_", "num2_", "=_", "3_", ",_", "op_", "=_", "Operation_", "._", "MULTIP", "LY_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d5", "_", "=_", "client_", "._", "calculate_", "(_", "3_", ",_", "w_", ")_", "._", "add", "Callbacks_", "(_", "got", "Calculat", "e", "Results_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "got", "Calculat", "e", "Errors_", ")_", "._", "add", "Errback_", "(_", "got", "Transp", "ort", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "w_", "=_", "Work", "_", "(_", "num1_", "=_", "2_", ",_", "num2_", "=_", "3_", ",_", "op_", "=_", "Operation_", "._", "DIVI", "DE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d6", "_", "=_", "client_", "._", "calculate_", "(_", "4_", ",_", "w_", ")_", "._", "add", "Callbacks_", "(_", "got", "Calculat", "e", "Results_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "got", "Calculat", "e", "Errors_", ")_", "._", "add", "Errback_", "(_", "got", "Transp", "ort", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "will", " ", "fire", " ", "an", " ", "errback", "_", "\\u\\u\\uNL\\u\\u\\u_", "w_", "=_", "Work", "_", "(_", "num1_", "=_", "2_", ",_", "num2_", "=_", "0_", ",_", "op_", "=_", "Operation_", "._", "DIVI", "DE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d7", "_", "=_", "client_", "._", "calculate_", "(_", "5_", ",_", "w_", ")_", "._", "add", "Callbacks_", "(_", "got", "Calculat", "e", "Results_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "got", "Calculat", "e", "Errors_", ")_", "._", "add", "Errback_", "(_", "got", "Transp", "ort", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d8", "_", "=_", "client_", "._", "zip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dl_", "=_", "defer_", "._", "Defe", "rre", "d", "List_", "(_", "[_", "d1_", ",_", "d2_", ",_", "d3_", ",_", "d4", "_", ",_", "d5", "_", ",_", "d6", "_", ",_", "d7", "_", ",_", "d8", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dl_", "._", "add", "Callback_", "(_", "lambda_", "\\u_", ":_", "reactor_", "._", "stop_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Conflicting attributes in base classes
sk-/git-lint/test/e2etest/test_e2e.py
[ { "content": "class E2EBase(object):\n\n\n\n\n\n\n\n # TODO(skreft): check that the first file has more than 1 error, check that\n # the second file has 1 new error, check also the lines that changed.\n\n", "metadata": "root.E2EBase", "header": "['module', '___EOS___']", "index": 25 }, { "content": " @staticmethod\n def lint():\n \"\"\"Returns the response and ouput of git-lint.\"\"\"\n out = io.StringIO()\n response = gitlint.main([], stdout=out, stderr=out)\n\n return response, out.getvalue()", "metadata": "root.E2EBase.lint", "header": "['class', 'E2EBase', '(', 'object', ')', ':', '___EOS___']", "index": 26 }, { "content": " @classmethod\n def setUpClass(cls):\n cls.original_cwd = os.getcwd()\n cls.temp_directory = tempfile.mkdtemp(prefix='gitlint')\n os.chdir(cls.temp_directory)\n cls.init_repo()", "metadata": "root.E2EBase.setUpClass", "header": "['class', 'E2EBase', '(', 'object', ')', ':', '___EOS___']", "index": 34 }, { "content": " def setUp(self):\n self.filename_repo = None", "metadata": "root.E2EBase.setUp", "header": "['class', 'E2EBase', '(', 'object', ')', ':', '___EOS___']", "index": 41 }, { "content": " @classmethod\n def tearDownClass(cls):\n shutil.rmtree(cls.temp_directory, True)\n os.chdir(cls.original_cwd)", "metadata": "root.E2EBase.tearDownClass", "header": "['class', 'E2EBase', '(', 'object', ')', ':', '___EOS___']", "index": 44 }, { "content": " def tearDown(self):\n if self.filename_repo is None:\n return\n\n with open(self.filename_repo, 'w') as f:\n pass\n self.add(self.filename_repo)\n self.commit('Commit teardown')", "metadata": "root.E2EBase.tearDown", "header": "['class', 'E2EBase', '(', 'object', ')', ':', '___EOS___']", "index": 49 }, { "content": " def test_extension_not_defined(self):\n extension = '.areallyfakeextension'\n filename = os.path.join(self.temp_directory, 'filename' + extension)\n with open(filename, 'w') as f:\n f.write('Foo')\n self.add(filename)\n response, output = self.lint()\n self.assertEquals(\n 0, response, 'Response %s != 0.\\nOutput:\\n%s' % (response, output))\n\n self.assertIn(os.path.relpath(filename), output)\n self.assertIn('SKIPPED', output)\n self.assertIn(extension, output)", "metadata": "root.E2EBase.test_extension_not_defined", "header": "['class', 'E2EBase', '(', 'object', ')', ':', '___EOS___']", "index": 58 }, { "content": " def get_linter_output(self, linter_name, file_path):\n cache_path = os.path.expanduser('~/.git-lint/cache')\n filename = os.path.join(cache_path, linter_name, file_path[1:])\n if not os.path.exists(filename):\n return 'No git-lint cache found for %s' % filename\n\n with open(filename) as f:\n output = f.read()\n return output", "metadata": "root.E2EBase.get_linter_output", "header": "['class', 'E2EBase', '(', 'object', ')', ':', '___EOS___']", "index": 72 }, { "content": " def assert_linter_works(self, linter_name, extension):\n \"\"\"Checks that the given linter works well for all the extensions.\n\n It requires that 3 files are defined:\n - <linter>/original.<extension>: A file with errors\n - <linter>/error.<extension>: New errors are introduced.\n - <linter>/nonewerror.<extension>: A line was modified/added from the\n last file, but no new errors are introduced.\n \"\"\"\n data_dirname = os.path.join(\n os.path.dirname(os.path.realpath(__file__)), 'data')\n self.filename_repo = filename_repo = os.path.join(\n self.temp_directory, '%s%s' % (linter_name, extension))\n filename_original = os.path.join(\n data_dirname, linter_name, 'original%s' % extension)\n filename_error = os.path.join(\n data_dirname, linter_name, 'error%s' % extension)\n filename_nonewerror = os.path.join(\n data_dirname, linter_name, 'nonewerror%s' % extension)\n\n self.assertTrue(\n os.path.exists(filename_original),\n 'You must define file \"%s\"' % filename_original)\n self.assertTrue(\n os.path.exists(filename_error),\n 'You must define file \"%s\"' % filename_error)\n self.assertTrue(os.path.exists(\n filename_nonewerror),\n 'You must define file \"%s\"' % filename_nonewerror)\n\n # Add file 1 (original) to repo\n shutil.copy(filename_original, filename_repo)\n self.add(filename_repo)\n self.commit('Commit 1')\n\n # Add file 2 (error) to repo\n shutil.copy(filename_error, filename_repo)\n response, output = self.lint()\n self.assertNotEquals(\n 0, response,\n ('Git lint for file %s should have failed.\\n git-lint output: %s' +\n '\\nLinter Output:\\n%s') %\n (filename_error,\n output,\n self.get_linter_output(linter_name, filename_repo)))\n self.add(filename_repo)\n self.commit('Commit 2')\n\n # Add file 3 (nonewerror) to repo\n shutil.copy(filename_nonewerror, filename_repo)\n response, output = self.lint()\n self.assertEquals(\n 0, response,\n ('Git lint for file %s should have not failed. \\nOutput:\\n%s') %\n (filename_nonewerror, output))\n self.add(filename_repo)\n self.commit('Commit 3')", "metadata": "root.E2EBase.assert_linter_works", "header": "['class', 'E2EBase', '(', 'object', ')', ':', '___EOS___']", "index": 84 }, { "content": " @classmethod\n def add_linter_check(cls, linter_name, extension):\n \"\"\"Adds a test for the given linter and extension.\"\"\"\n def test_linter(self):\n self.assert_linter_works(linter_name, extension)\n test_linter.__name__ = 'test_linter_%s_with_%s' % (linter_name,\n extension[1:])\n setattr(cls, test_linter.__name__, test_linter)", "metadata": "root.E2EBase.add_linter_check", "header": "['class', 'E2EBase', '(', 'object', ')', ':', '___EOS___']", "index": 142 }, { "content": " @classmethod\n def add_linter_checks(cls):\n \"\"\"Add a test for each defined linter and extension.\"\"\"\n for extension, linter_list in gitlint.get_config(None).items():\n for linter in linter_list:\n cls.add_linter_check(linter.args[0], extension)", "metadata": "root.E2EBase.add_linter_checks", "header": "['class', 'E2EBase', '(', 'object', ')', ':', '___EOS___']", "index": 151 }, { "content": "class TestGitE2E(E2EBase, unittest.TestCase):\n\n\n", "metadata": "root.TestGitE2E", "header": "['module', '___EOS___']", "index": 172 }, { "content": "class TestHgE2E(E2EBase, unittest.TestCase):\n\n", "metadata": "root.TestHgE2E", "header": "['module', '___EOS___']", "index": 231 } ]
[ { "span": "class TestGitE2E(E2EBase, unittest.TestCase):", "start_line": 172, "start_column": 0, "end_line": 172, "end_column": 45 }, { "span": "class TestHgE2E(E2EBase, unittest.TestCase):", "start_line": 231, "start_column": 0, "end_line": 231, "end_column": 44 } ]
[ { "span": "classmethod", "start_line": 34, "start_column": 5, "end_line": 34, "end_column": 16 }, { "span": "classmethod", "start_line": 44, "start_column": 5, "end_line": 44, "end_column": 16 } ]
1
false
[ "[CLS]_", "Confl", "ict", "ing_", "attributes_", "in_", "base_", "classes_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "E2", "EB", "ase_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", "(", "skr", "eft", "):", " ", "check", " ", "tha", "t", " ", "the", " ", "first", " ", "file", " ", "has", " ", "more", " ", "than", " ", "1", " ", "error", ",", " ", "check", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "second", " ", "file", " ", "has", " ", "1", " ", "new", " ", "error", ",", " ", "check", " ", "als", "o", " ", "the", " ", "lines", " ", "tha", "t", " ", "change", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "E2", "EB", "ase_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "lint_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "response", " ", "and", " ", "oup", "ut", " ", "of", " ", "git", "-", "lint", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "io_", "._", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "git", "lint_", "._", "main_", "(_", "[_", "]_", ",_", "stdout_", "=_", "out_", ",_", "stderr_", "=_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "response_", ",_", "out_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "E2", "EB", "ase_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set", "Up", "Class_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "original", "\\u", "cwd_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "temp", "\\u", "directory_", "=_", "tempfile_", "._", "mkdtemp_", "(_", "prefix_", "=_", "'", "git", "lint", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chdir_", "(_", "cls_", "._", "temp", "\\u", "directory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "init", "\\u", "repo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "E2", "EB", "ase_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "filename", "\\u", "repo_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "E2", "EB", "ase_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "tear", "Down", "Class_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "rmtree_", "(_", "cls_", "._", "temp", "\\u", "directory_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chdir_", "(_", "cls_", "._", "original", "\\u", "cwd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "E2", "EB", "ase_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "filename", "\\u", "repo_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "self_", "._", "filename", "\\u", "repo_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "add_", "(_", "self_", "._", "filename", "\\u", "repo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "commit_", "(_", "'", "Commi", "t", " ", "tear", "down", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "E2", "EB", "ase_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "extensi", "on", "\\u", "not", "\\u", "defined_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extension_", "=_", "'.", "area", "ll", "yf", "ake", "extensi", "on", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "temp", "\\u", "directory_", ",_", "'", "filename", "'_", "+_", "extension_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "filename_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "'", "Foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "add_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", ",_", "output_", "=_", "self_", "._", "lint_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "response_", ",_", "'", "Respons", "e", " ", "%", "s", " ", "!=", " ", "0.", "\\\\", "n", "Output", ":\\\\", "n", "%", "s", "'_", "%_", "(_", "response_", ",_", "output_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "os_", "._", "path_", "._", "relpath_", "(_", "filename_", ")_", ",_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "'", "SKIP", "PED", "'_", ",_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "extension_", ",_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "E2", "EB", "ase_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "linter", "\\u", "output_", "(_", "self_", ",_", "linter", "\\u", "name_", ",_", "file", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache", "\\u", "path_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "'", "~", "/.", "git", "-", "lint", "/", "cache", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "cache", "\\u", "path_", ",_", "linter", "\\u", "name_", ",_", "file", "\\u", "path_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "No", " ", "git", "-", "lint", " ", "cache", " ", "found", " ", "for", " ", "%", "s", "'_", "%_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "filename_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "E2", "EB", "ase_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "assert", "\\u", "linter", "\\u", "works_", "(_", "self_", ",_", "linter", "\\u", "name_", ",_", "extension_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "s", " ", "tha", "t", " ", "the", " ", "give", "n", " ", "linter", " ", "works", " ", "well", " ", "for", " ", "all", " ", "the", " ", "extensi", "ons", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "require", "s", " ", "tha", "t", " ", "3", " ", "files", " ", "are", " ", "defin", "ed", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "<", "linter", ">/", "original", ".", "<", "extensi", "on", ">:", " ", "A", " ", "file", " ", "with", " ", "error", "s", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "<", "linter", ">/", "error", ".", "<", "extensi", "on", ">:", " ", "New", " ", "error", "s", " ", "are", " ", "introduce", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "<", "linter", ">/", "none", "wer", "ror", ".", "<", "extensi", "on", ">:", " ", "A", " ", "line", " ", "was", " ", "modifi", "ed", "/", "adde", "d", " ", "from", " ", "the", "\\", "10", ";", " ", " ", "last", " ", "file", ",", " ", "but", " ", "no", " ", "new", " ", "error", "s", " ", "are", " ", "introduce", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "dirname_", "=_", "os_", "._", "path_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "realpath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ",_", "'", "data", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filename", "\\u", "repo_", "=_", "filename", "\\u", "repo_", "=_", "os_", "._", "path_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "temp", "\\u", "directory_", ",_", "'%", "s", "%", "s", "'_", "%_", "(_", "linter", "\\u", "name_", ",_", "extension_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename", "\\u", "original_", "=_", "os_", "._", "path_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "dirname_", ",_", "linter", "\\u", "name_", ",_", "'", "original", "%", "s", "'_", "%_", "extension_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename", "\\u", "error_", "=_", "os_", "._", "path_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "dirname_", ",_", "linter", "\\u", "name_", ",_", "'", "error", "%", "s", "'_", "%_", "extension_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename", "\\u", "none", "wer", "ror_", "=_", "os_", "._", "path_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "dirname_", ",_", "linter", "\\u", "name_", ",_", "'", "none", "wer", "ror", "%", "s", "'_", "%_", "extension_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "exists_", "(_", "filename", "\\u", "original_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "You", " ", "must", " ", "defin", "e", " ", "file", " ", "\"%", "s", "\"'_", "%_", "filename", "\\u", "original_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "exists_", "(_", "filename", "\\u", "error_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "You", " ", "must", " ", "defin", "e", " ", "file", " ", "\"%", "s", "\"'_", "%_", "filename", "\\u", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "os_", "._", "path_", "._", "exists_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "filename", "\\u", "none", "wer", "ror_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "You", " ", "must", " ", "defin", "e", " ", "file", " ", "\"%", "s", "\"'_", "%_", "filename", "\\u", "none", "wer", "ror_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "file", " ", "1", " ", "(", "original", ")", " ", "to", " ", "repo_", "\\u\\u\\uNL\\u\\u\\u_", "shutil_", "._", "copy_", "(_", "filename", "\\u", "original_", ",_", "filename", "\\u", "repo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add_", "(_", "filename", "\\u", "repo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "commit_", "(_", "'", "Commi", "t", " ", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "file", " ", "2", " ", "(", "error", ")", " ", "to", " ", "repo_", "\\u\\u\\uNL\\u\\u\\u_", "shutil_", "._", "copy_", "(_", "filename", "\\u", "error_", ",_", "filename", "\\u", "repo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", ",_", "output_", "=_", "self_", "._", "lint_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equals_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Git", " ", "lint", " ", "for", " ", "file", " ", "%", "s", " ", "shou", "ld", " ", "have", " ", "fail", "ed", ".\\\\", "n", " ", "git", "-", "lint", " ", "output", ":", " ", "%", "s", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "n", "Lin", "ter", " ", "Output", ":\\\\", "n", "%", "s", "'_", ")_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "filename", "\\u", "error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "get", "\\u", "linter", "\\u", "output_", "(_", "linter", "\\u", "name_", ",_", "filename", "\\u", "repo_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add_", "(_", "filename", "\\u", "repo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "commit_", "(_", "'", "Commi", "t", " ", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "file", " ", "3", " ", "(", "none", "wer", "ror", ")", " ", "to", " ", "repo_", "\\u\\u\\uNL\\u\\u\\u_", "shutil_", "._", "copy_", "(_", "filename", "\\u", "none", "wer", "ror_", ",_", "filename", "\\u", "repo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", ",_", "output_", "=_", "self_", "._", "lint_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Git", " ", "lint", " ", "for", " ", "file", " ", "%", "s", " ", "shou", "ld", " ", "have", " ", "not", " ", "fail", "ed", ".", " ", "\\\\", "n", "Output", ":\\\\", "n", "%", "s", "'_", ")_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "filename", "\\u", "none", "wer", "ror_", ",_", "output_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add_", "(_", "filename", "\\u", "repo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "commit_", "(_", "'", "Commi", "t", " ", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "E2", "EB", "ase_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "add", "\\u", "linter", "\\u", "check_", "(_", "cls_", ",_", "linter", "\\u", "name_", ",_", "extension_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", "s", " ", "a", " ", "test", " ", "for", " ", "the", " ", "give", "n", " ", "linter", " ", "and", " ", "extensi", "on", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "linter", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "\\u", "linter", "\\u", "works_", "(_", "linter", "\\u", "name_", ",_", "extension_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test\\u", "linter", "_", "._", "\\u\\u", "name\\u\\u_", "=_", "'", "test\\u", "linter", "\\u", "%", "s", "\\u", "with", "\\u", "%", "s", "'_", "%_", "(_", "linter", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extension_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "cls_", ",_", "test\\u", "linter", "_", "._", "\\u\\u", "name\\u\\u_", ",_", "test\\u", "linter", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "E2", "EB", "ase_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "add", "\\u", "linter", "\\u", "checks_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", " ", "a", " ", "test", " ", "for", " ", "each", " ", "defin", "ed", " ", "linter", " ", "and", " ", "extensi", "on", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "extension_", ",_", "linter", "\\u", "list_", "in_", "git", "lint_", "._", "get", "\\u", "config_", "(_", "None_", ")_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "linter", "_", "in_", "linter", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "add", "\\u", "linter", "\\u", "check_", "(_", "linter", "_", "._", "args_", "[_", "0_", "]_", ",_", "extension_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Git", "E2", "E_", "(_", "E2", "EB", "ase_", ",_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Hg", "E2", "E_", "(_", "E2", "EB", "ase_", ",_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2 ]
Unused import
cloudera/hue/apps/impala/gen-py/ImpalaService/ttypes.py
[ { "content": "#\n# Autogenerated by Thrift Compiler (0.9.3)\n#\n# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n#\n# options string: py:new_style\n#\n\nfrom thrift.Thrift import TType, TMessageType, TException, TApplicationException\nimport ExecStats.ttypes\nimport Status.ttypes\nimport Types.ttypes\nimport beeswaxd.ttypes\nimport TCLIService.ttypes\n\n\nfrom thrift.transport import TTransport\nfrom thrift.protocol import TBinaryProtocol, TProtocol\ntry:\n from thrift.protocol import fastbinary\nexcept:\n fastbinary = None\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TImpalaQueryOptions(object):\n ABORT_ON_ERROR = 0\n MAX_ERRORS = 1\n DISABLE_CODEGEN = 2\n BATCH_SIZE = 3\n MEM_LIMIT = 4\n NUM_NODES = 5\n MAX_SCAN_RANGE_LENGTH = 6\n MAX_IO_BUFFERS = 7\n NUM_SCANNER_THREADS = 8\n ALLOW_UNSUPPORTED_FORMATS = 9\n DEFAULT_ORDER_BY_LIMIT = 10\n DEBUG_ACTION = 11\n ABORT_ON_DEFAULT_LIMIT_EXCEEDED = 12\n COMPRESSION_CODEC = 13\n SEQ_COMPRESSION_MODE = 14\n HBASE_CACHING = 15\n HBASE_CACHE_BLOCKS = 16\n PARQUET_FILE_SIZE = 17\n EXPLAIN_LEVEL = 18\n SYNC_DDL = 19\n REQUEST_POOL = 20\n V_CPU_CORES = 21\n RESERVATION_REQUEST_TIMEOUT = 22\n DISABLE_CACHED_READS = 23\n DISABLE_OUTERMOST_TOPN = 24\n RM_INITIAL_MEM = 25\n QUERY_TIMEOUT_S = 26\n MAX_BLOCK_MGR_MEMORY = 27\n APPX_COUNT_DISTINCT = 28\n DISABLE_UNSAFE_SPILLS = 29\n EXEC_SINGLE_NODE_ROWS_THRESHOLD = 30\n\n _VALUES_TO_NAMES = {\n 0: \"ABORT_ON_ERROR\",\n 1: \"MAX_ERRORS\",\n 2: \"DISABLE_CODEGEN\",\n 3: \"BATCH_SIZE\",\n 4: \"MEM_LIMIT\",\n 5: \"NUM_NODES\",\n 6: \"MAX_SCAN_RANGE_LENGTH\",\n 7: \"MAX_IO_BUFFERS\",\n 8: \"NUM_SCANNER_THREADS\",\n 9: \"ALLOW_UNSUPPORTED_FORMATS\",\n 10: \"DEFAULT_ORDER_BY_LIMIT\",\n 11: \"DEBUG_ACTION\",\n 12: \"ABORT_ON_DEFAULT_LIMIT_EXCEEDED\",\n 13: \"COMPRESSION_CODEC\",\n 14: \"SEQ_COMPRESSION_MODE\",\n 15: \"HBASE_CACHING\",\n 16: \"HBASE_CACHE_BLOCKS\",\n 17: \"PARQUET_FILE_SIZE\",\n 18: \"EXPLAIN_LEVEL\",\n 19: \"SYNC_DDL\",\n 20: \"REQUEST_POOL\",\n 21: \"V_CPU_CORES\",\n 22: \"RESERVATION_REQUEST_TIMEOUT\",\n 23: \"DISABLE_CACHED_READS\",\n 24: \"DISABLE_OUTERMOST_TOPN\",\n 25: \"RM_INITIAL_MEM\",\n 26: \"QUERY_TIMEOUT_S\",\n 27: \"MAX_BLOCK_MGR_MEMORY\",\n 28: \"APPX_COUNT_DISTINCT\",\n 29: \"DISABLE_UNSAFE_SPILLS\",\n 30: \"EXEC_SINGLE_NODE_ROWS_THRESHOLD\",\n }\n\n _NAMES_TO_VALUES = {\n \"ABORT_ON_ERROR\": 0,\n \"MAX_ERRORS\": 1,\n \"DISABLE_CODEGEN\": 2,\n \"BATCH_SIZE\": 3,\n \"MEM_LIMIT\": 4,\n \"NUM_NODES\": 5,\n \"MAX_SCAN_RANGE_LENGTH\": 6,\n \"MAX_IO_BUFFERS\": 7,\n \"NUM_SCANNER_THREADS\": 8,\n \"ALLOW_UNSUPPORTED_FORMATS\": 9,\n \"DEFAULT_ORDER_BY_LIMIT\": 10,\n \"DEBUG_ACTION\": 11,\n \"ABORT_ON_DEFAULT_LIMIT_EXCEEDED\": 12,\n \"COMPRESSION_CODEC\": 13,\n \"SEQ_COMPRESSION_MODE\": 14,\n \"HBASE_CACHING\": 15,\n \"HBASE_CACHE_BLOCKS\": 16,\n \"PARQUET_FILE_SIZE\": 17,\n \"EXPLAIN_LEVEL\": 18,\n \"SYNC_DDL\": 19,\n \"REQUEST_POOL\": 20,\n \"V_CPU_CORES\": 21,\n \"RESERVATION_REQUEST_TIMEOUT\": 22,\n \"DISABLE_CACHED_READS\": 23,\n \"DISABLE_OUTERMOST_TOPN\": 24,\n \"RM_INITIAL_MEM\": 25,\n \"QUERY_TIMEOUT_S\": 26,\n \"MAX_BLOCK_MGR_MEMORY\": 27,\n \"APPX_COUNT_DISTINCT\": 28,\n \"DISABLE_UNSAFE_SPILLS\": 29,\n \"EXEC_SINGLE_NODE_ROWS_THRESHOLD\": 30,\n }", "metadata": "root.TImpalaQueryOptions", "header": "['module', '___EOS___']", "index": 24 }, { "content": "class TInsertResult(object):\n \"\"\"\n Attributes:\n - rows_appended\n \"\"\"\n\n thrift_spec = (\n None, # 0\n (1, TType.MAP, 'rows_appended', (TType.STRING,None,TType.I64,None), None, ), # 1\n )\n\n\n\n\n\n\n\n\n", "metadata": "root.TInsertResult", "header": "['module', '___EOS___']", "index": 126 }, { "content": " def __init__(self, rows_appended=None,):\n self.rows_appended = rows_appended", "metadata": "root.TInsertResult.__init__", "header": "['class', 'TInsertResult', '(', 'object', ')', ':', '___EOS___']", "index": 137 }, { "content": " def read(self, iprot):\n if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n return\n iprot.readStructBegin()\n while True:\n (fname, ftype, fid) = iprot.readFieldBegin()\n if ftype == TType.STOP:\n break\n if fid == 1:\n if ftype == TType.MAP:\n self.rows_appended = {}\n (_ktype1, _vtype2, _size0 ) = iprot.readMapBegin()\n for _i4 in xrange(_size0):\n _key5 = iprot.readString()\n _val6 = iprot.readI64()\n self.rows_appended[_key5] = _val6\n iprot.readMapEnd()\n else:\n iprot.skip(ftype)\n else:\n iprot.skip(ftype)\n iprot.readFieldEnd()\n iprot.readStructEnd()", "metadata": "root.TInsertResult.read", "header": "['class', 'TInsertResult', '(', 'object', ')', ':', '___EOS___']", "index": 140 }, { "content": " def write(self, oprot):\n if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n return\n oprot.writeStructBegin('TInsertResult')\n if self.rows_appended is not None:\n oprot.writeFieldBegin('rows_appended', TType.MAP, 1)\n oprot.writeMapBegin(TType.STRING, TType.I64, len(self.rows_appended))\n for kiter7,viter8 in self.rows_appended.items():\n oprot.writeString(kiter7)\n oprot.writeI64(viter8)\n oprot.writeMapEnd()\n oprot.writeFieldEnd()\n oprot.writeFieldStop()\n oprot.writeStructEnd()", "metadata": "root.TInsertResult.write", "header": "['class', 'TInsertResult', '(', 'object', ')', ':', '___EOS___']", "index": 165 }, { "content": " def validate(self):\n if self.rows_appended is None:\n raise TProtocol.TProtocolException(message='Required field rows_appended is unset!')\n return", "metadata": "root.TInsertResult.validate", "header": "['class', 'TInsertResult', '(', 'object', ')', ':', '___EOS___']", "index": 181 }, { "content": " def __hash__(self):\n value = 17\n value = (value * 31) ^ hash(self.rows_appended)\n return value", "metadata": "root.TInsertResult.__hash__", "header": "['class', 'TInsertResult', '(', 'object', ')', ':', '___EOS___']", "index": 187 }, { "content": " def __repr__(self):\n L = ['%s=%r' % (key, value)\n for key, value in self.__dict__.iteritems()]\n return '%s(%s)' % (self.__class__.__name__, ', '.join(L))", "metadata": "root.TInsertResult.__repr__", "header": "['class', 'TInsertResult', '(', 'object', ')', ':', '___EOS___']", "index": 192 }, { "content": " def __eq__(self, other):\n return isinstance(other, self.__class__) and self.__dict__ == other.__dict__", "metadata": "root.TInsertResult.__eq__", "header": "['class', 'TInsertResult', '(', 'object', ')', ':', '___EOS___']", "index": 197 }, { "content": " def __ne__(self, other):\n return not (self == other)", "metadata": "root.TInsertResult.__ne__", "header": "['class', 'TInsertResult', '(', 'object', ')', ':', '___EOS___']", "index": 200 }, { "content": "class TPingImpalaServiceResp(object):\n \"\"\"\n Attributes:\n - version\n \"\"\"\n\n thrift_spec = (\n None, # 0\n (1, TType.STRING, 'version', None, None, ), # 1\n )\n\n\n\n\n\n\n\n\n", "metadata": "root.TPingImpalaServiceResp", "header": "['module', '___EOS___']", "index": 203 }, { "content": " def __init__(self, version=None,):\n self.version = version", "metadata": "root.TPingImpalaServiceResp.__init__", "header": "['class', 'TPingImpalaServiceResp', '(', 'object', ')', ':', '___EOS___']", "index": 214 }, { "content": " def read(self, iprot):\n if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n return\n iprot.readStructBegin()\n while True:\n (fname, ftype, fid) = iprot.readFieldBegin()\n if ftype == TType.STOP:\n break\n if fid == 1:\n if ftype == TType.STRING:\n self.version = iprot.readString()\n else:\n iprot.skip(ftype)\n else:\n iprot.skip(ftype)\n iprot.readFieldEnd()\n iprot.readStructEnd()", "metadata": "root.TPingImpalaServiceResp.read", "header": "['class', 'TPingImpalaServiceResp', '(', 'object', ')', ':', '___EOS___']", "index": 217 }, { "content": " def write(self, oprot):\n if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n return\n oprot.writeStructBegin('TPingImpalaServiceResp')\n if self.version is not None:\n oprot.writeFieldBegin('version', TType.STRING, 1)\n oprot.writeString(self.version)\n oprot.writeFieldEnd()\n oprot.writeFieldStop()\n oprot.writeStructEnd()", "metadata": "root.TPingImpalaServiceResp.write", "header": "['class', 'TPingImpalaServiceResp', '(', 'object', ')', ':', '___EOS___']", "index": 236 }, { "content": " def validate(self):\n return", "metadata": "root.TPingImpalaServiceResp.validate", "header": "['class', 'TPingImpalaServiceResp', '(', 'object', ')', ':', '___EOS___']", "index": 248 }, { "content": " def __hash__(self):\n value = 17\n value = (value * 31) ^ hash(self.version)\n return value", "metadata": "root.TPingImpalaServiceResp.__hash__", "header": "['class', 'TPingImpalaServiceResp', '(', 'object', ')', ':', '___EOS___']", "index": 252 }, { "content": " def __repr__(self):\n L = ['%s=%r' % (key, value)\n for key, value in self.__dict__.iteritems()]\n return '%s(%s)' % (self.__class__.__name__, ', '.join(L))", "metadata": "root.TPingImpalaServiceResp.__repr__", "header": "['class', 'TPingImpalaServiceResp', '(', 'object', ')', ':', '___EOS___']", "index": 257 }, { "content": " def __eq__(self, other):\n return isinstance(other, self.__class__) and self.__dict__ == other.__dict__", "metadata": "root.TPingImpalaServiceResp.__eq__", "header": "['class', 'TPingImpalaServiceResp', '(', 'object', ')', ':', '___EOS___']", "index": 262 }, { "content": " def __ne__(self, other):\n return not (self == other)", "metadata": "root.TPingImpalaServiceResp.__ne__", "header": "['class', 'TPingImpalaServiceResp', '(', 'object', ')', ':', '___EOS___']", "index": 265 }, { "content": "class TResetTableReq(object):\n \"\"\"\n Attributes:\n - db_name\n - table_name\n \"\"\"\n\n thrift_spec = (\n None, # 0\n (1, TType.STRING, 'db_name', None, None, ), # 1\n (2, TType.STRING, 'table_name', None, None, ), # 2\n )\n\n\n\n\n\n\n\n\n", "metadata": "root.TResetTableReq", "header": "['module', '___EOS___']", "index": 268 }, { "content": " def __init__(self, db_name=None, table_name=None,):\n self.db_name = db_name\n self.table_name = table_name", "metadata": "root.TResetTableReq.__init__", "header": "['class', 'TResetTableReq', '(', 'object', ')', ':', '___EOS___']", "index": 281 }, { "content": " def read(self, iprot):\n if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n return\n iprot.readStructBegin()\n while True:\n (fname, ftype, fid) = iprot.readFieldBegin()\n if ftype == TType.STOP:\n break\n if fid == 1:\n if ftype == TType.STRING:\n self.db_name = iprot.readString()\n else:\n iprot.skip(ftype)\n elif fid == 2:\n if ftype == TType.STRING:\n self.table_name = iprot.readString()\n else:\n iprot.skip(ftype)\n else:\n iprot.skip(ftype)\n iprot.readFieldEnd()\n iprot.readStructEnd()", "metadata": "root.TResetTableReq.read", "header": "['class', 'TResetTableReq', '(', 'object', ')', ':', '___EOS___']", "index": 285 }, { "content": " def write(self, oprot):\n if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n return\n oprot.writeStructBegin('TResetTableReq')\n if self.db_name is not None:\n oprot.writeFieldBegin('db_name', TType.STRING, 1)\n oprot.writeString(self.db_name)\n oprot.writeFieldEnd()\n if self.table_name is not None:\n oprot.writeFieldBegin('table_name', TType.STRING, 2)\n oprot.writeString(self.table_name)\n oprot.writeFieldEnd()\n oprot.writeFieldStop()\n oprot.writeStructEnd()", "metadata": "root.TResetTableReq.write", "header": "['class', 'TResetTableReq', '(', 'object', ')', ':', '___EOS___']", "index": 309 }, { "content": " def validate(self):\n if self.db_name is None:\n raise TProtocol.TProtocolException(message='Required field db_name is unset!')\n if self.table_name is None:\n raise TProtocol.TProtocolException(message='Required field table_name is unset!')\n return", "metadata": "root.TResetTableReq.validate", "header": "['class', 'TResetTableReq', '(', 'object', ')', ':', '___EOS___']", "index": 325 }, { "content": " def __hash__(self):\n value = 17\n value = (value * 31) ^ hash(self.db_name)\n value = (value * 31) ^ hash(self.table_name)\n return value", "metadata": "root.TResetTableReq.__hash__", "header": "['class', 'TResetTableReq', '(', 'object', ')', ':', '___EOS___']", "index": 333 }, { "content": " def __repr__(self):\n L = ['%s=%r' % (key, value)\n for key, value in self.__dict__.iteritems()]\n return '%s(%s)' % (self.__class__.__name__, ', '.join(L))", "metadata": "root.TResetTableReq.__repr__", "header": "['class', 'TResetTableReq', '(', 'object', ')', ':', '___EOS___']", "index": 339 }, { "content": " def __eq__(self, other):\n return isinstance(other, self.__class__) and self.__dict__ == other.__dict__", "metadata": "root.TResetTableReq.__eq__", "header": "['class', 'TResetTableReq', '(', 'object', ')', ':', '___EOS___']", "index": 344 }, { "content": " def __ne__(self, other):\n return not (self == other)", "metadata": "root.TResetTableReq.__ne__", "header": "['class', 'TResetTableReq', '(', 'object', ')', ':', '___EOS___']", "index": 347 }, { "content": "class TGetExecSummaryReq(object):\n \"\"\"\n Attributes:\n - operationHandle\n - sessionHandle\n \"\"\"\n\n thrift_spec = (\n None, # 0\n (1, TType.STRUCT, 'operationHandle', (TCLIService.ttypes.TOperationHandle, TCLIService.ttypes.TOperationHandle.thrift_spec), None, ), # 1\n (2, TType.STRUCT, 'sessionHandle', (TCLIService.ttypes.TSessionHandle, TCLIService.ttypes.TSessionHandle.thrift_spec), None, ), # 2\n )\n\n\n\n\n\n\n\n\n", "metadata": "root.TGetExecSummaryReq", "header": "['module', '___EOS___']", "index": 350 }, { "content": " def __init__(self, operationHandle=None, sessionHandle=None,):\n self.operationHandle = operationHandle\n self.sessionHandle = sessionHandle", "metadata": "root.TGetExecSummaryReq.__init__", "header": "['class', 'TGetExecSummaryReq', '(', 'object', ')', ':', '___EOS___']", "index": 363 }, { "content": " def read(self, iprot):\n if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n return\n iprot.readStructBegin()\n while True:\n (fname, ftype, fid) = iprot.readFieldBegin()\n if ftype == TType.STOP:\n break\n if fid == 1:\n if ftype == TType.STRUCT:\n self.operationHandle = TCLIService.ttypes.TOperationHandle()\n self.operationHandle.read(iprot)\n else:\n iprot.skip(ftype)\n elif fid == 2:\n if ftype == TType.STRUCT:\n self.sessionHandle = TCLIService.ttypes.TSessionHandle()\n self.sessionHandle.read(iprot)\n else:\n iprot.skip(ftype)\n else:\n iprot.skip(ftype)\n iprot.readFieldEnd()\n iprot.readStructEnd()", "metadata": "root.TGetExecSummaryReq.read", "header": "['class', 'TGetExecSummaryReq', '(', 'object', ')', ':', '___EOS___']", "index": 367 }, { "content": " def write(self, oprot):\n if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n return\n oprot.writeStructBegin('TGetExecSummaryReq')\n if self.operationHandle is not None:\n oprot.writeFieldBegin('operationHandle', TType.STRUCT, 1)\n self.operationHandle.write(oprot)\n oprot.writeFieldEnd()\n if self.sessionHandle is not None:\n oprot.writeFieldBegin('sessionHandle', TType.STRUCT, 2)\n self.sessionHandle.write(oprot)\n oprot.writeFieldEnd()\n oprot.writeFieldStop()\n oprot.writeStructEnd()", "metadata": "root.TGetExecSummaryReq.write", "header": "['class', 'TGetExecSummaryReq', '(', 'object', ')', ':', '___EOS___']", "index": 393 }, { "content": " def validate(self):\n return", "metadata": "root.TGetExecSummaryReq.validate", "header": "['class', 'TGetExecSummaryReq', '(', 'object', ')', ':', '___EOS___']", "index": 409 }, { "content": " def __hash__(self):\n value = 17\n value = (value * 31) ^ hash(self.operationHandle)\n value = (value * 31) ^ hash(self.sessionHandle)\n return value", "metadata": "root.TGetExecSummaryReq.__hash__", "header": "['class', 'TGetExecSummaryReq', '(', 'object', ')', ':', '___EOS___']", "index": 413 }, { "content": " def __repr__(self):\n L = ['%s=%r' % (key, value)\n for key, value in self.__dict__.iteritems()]\n return '%s(%s)' % (self.__class__.__name__, ', '.join(L))", "metadata": "root.TGetExecSummaryReq.__repr__", "header": "['class', 'TGetExecSummaryReq', '(', 'object', ')', ':', '___EOS___']", "index": 419 }, { "content": " def __eq__(self, other):\n return isinstance(other, self.__class__) and self.__dict__ == other.__dict__", "metadata": "root.TGetExecSummaryReq.__eq__", "header": "['class', 'TGetExecSummaryReq', '(', 'object', ')', ':', '___EOS___']", "index": 424 }, { "content": " def __ne__(self, other):\n return not (self == other)", "metadata": "root.TGetExecSummaryReq.__ne__", "header": "['class', 'TGetExecSummaryReq', '(', 'object', ')', ':', '___EOS___']", "index": 427 }, { "content": "class TGetExecSummaryResp(object):\n \"\"\"\n Attributes:\n - status\n - summary\n \"\"\"\n\n thrift_spec = (\n None, # 0\n (1, TType.STRUCT, 'status', (TCLIService.ttypes.TStatus, TCLIService.ttypes.TStatus.thrift_spec), None, ), # 1\n (2, TType.STRUCT, 'summary', (ExecStats.ttypes.TExecSummary, ExecStats.ttypes.TExecSummary.thrift_spec), None, ), # 2\n )\n\n\n\n\n\n\n\n\n", "metadata": "root.TGetExecSummaryResp", "header": "['module', '___EOS___']", "index": 430 }, { "content": " def __init__(self, status=None, summary=None,):\n self.status = status\n self.summary = summary", "metadata": "root.TGetExecSummaryResp.__init__", "header": "['class', 'TGetExecSummaryResp', '(', 'object', ')', ':', '___EOS___']", "index": 443 }, { "content": " def read(self, iprot):\n if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n return\n iprot.readStructBegin()\n while True:\n (fname, ftype, fid) = iprot.readFieldBegin()\n if ftype == TType.STOP:\n break\n if fid == 1:\n if ftype == TType.STRUCT:\n self.status = TCLIService.ttypes.TStatus()\n self.status.read(iprot)\n else:\n iprot.skip(ftype)\n elif fid == 2:\n if ftype == TType.STRUCT:\n self.summary = ExecStats.ttypes.TExecSummary()\n self.summary.read(iprot)\n else:\n iprot.skip(ftype)\n else:\n iprot.skip(ftype)\n iprot.readFieldEnd()\n iprot.readStructEnd()", "metadata": "root.TGetExecSummaryResp.read", "header": "['class', 'TGetExecSummaryResp', '(', 'object', ')', ':', '___EOS___']", "index": 447 }, { "content": " def write(self, oprot):\n if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n return\n oprot.writeStructBegin('TGetExecSummaryResp')\n if self.status is not None:\n oprot.writeFieldBegin('status', TType.STRUCT, 1)\n self.status.write(oprot)\n oprot.writeFieldEnd()\n if self.summary is not None:\n oprot.writeFieldBegin('summary', TType.STRUCT, 2)\n self.summary.write(oprot)\n oprot.writeFieldEnd()\n oprot.writeFieldStop()\n oprot.writeStructEnd()", "metadata": "root.TGetExecSummaryResp.write", "header": "['class', 'TGetExecSummaryResp', '(', 'object', ')', ':', '___EOS___']", "index": 473 }, { "content": " def validate(self):\n if self.status is None:\n raise TProtocol.TProtocolException(message='Required field status is unset!')\n return", "metadata": "root.TGetExecSummaryResp.validate", "header": "['class', 'TGetExecSummaryResp', '(', 'object', ')', ':', '___EOS___']", "index": 489 }, { "content": " def __hash__(self):\n value = 17\n value = (value * 31) ^ hash(self.status)\n value = (value * 31) ^ hash(self.summary)\n return value", "metadata": "root.TGetExecSummaryResp.__hash__", "header": "['class', 'TGetExecSummaryResp', '(', 'object', ')', ':', '___EOS___']", "index": 495 }, { "content": " def __repr__(self):\n L = ['%s=%r' % (key, value)\n for key, value in self.__dict__.iteritems()]\n return '%s(%s)' % (self.__class__.__name__, ', '.join(L))", "metadata": "root.TGetExecSummaryResp.__repr__", "header": "['class', 'TGetExecSummaryResp', '(', 'object', ')', ':', '___EOS___']", "index": 501 }, { "content": " def __eq__(self, other):\n return isinstance(other, self.__class__) and self.__dict__ == other.__dict__", "metadata": "root.TGetExecSummaryResp.__eq__", "header": "['class', 'TGetExecSummaryResp', '(', 'object', ')', ':', '___EOS___']", "index": 506 }, { "content": " def __ne__(self, other):\n return not (self == other)", "metadata": "root.TGetExecSummaryResp.__ne__", "header": "['class', 'TGetExecSummaryResp', '(', 'object', ')', ':', '___EOS___']", "index": 509 }, { "content": "class TGetRuntimeProfileReq(object):\n \"\"\"\n Attributes:\n - operationHandle\n - sessionHandle\n \"\"\"\n\n thrift_spec = (\n None, # 0\n (1, TType.STRUCT, 'operationHandle', (TCLIService.ttypes.TOperationHandle, TCLIService.ttypes.TOperationHandle.thrift_spec), None, ), # 1\n (2, TType.STRUCT, 'sessionHandle', (TCLIService.ttypes.TSessionHandle, TCLIService.ttypes.TSessionHandle.thrift_spec), None, ), # 2\n )\n\n\n\n\n\n\n\n\n", "metadata": "root.TGetRuntimeProfileReq", "header": "['module', '___EOS___']", "index": 512 }, { "content": " def __init__(self, operationHandle=None, sessionHandle=None,):\n self.operationHandle = operationHandle\n self.sessionHandle = sessionHandle", "metadata": "root.TGetRuntimeProfileReq.__init__", "header": "['class', 'TGetRuntimeProfileReq', '(', 'object', ')', ':', '___EOS___']", "index": 525 }, { "content": " def read(self, iprot):\n if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n return\n iprot.readStructBegin()\n while True:\n (fname, ftype, fid) = iprot.readFieldBegin()\n if ftype == TType.STOP:\n break\n if fid == 1:\n if ftype == TType.STRUCT:\n self.operationHandle = TCLIService.ttypes.TOperationHandle()\n self.operationHandle.read(iprot)\n else:\n iprot.skip(ftype)\n elif fid == 2:\n if ftype == TType.STRUCT:\n self.sessionHandle = TCLIService.ttypes.TSessionHandle()\n self.sessionHandle.read(iprot)\n else:\n iprot.skip(ftype)\n else:\n iprot.skip(ftype)\n iprot.readFieldEnd()\n iprot.readStructEnd()", "metadata": "root.TGetRuntimeProfileReq.read", "header": "['class', 'TGetRuntimeProfileReq', '(', 'object', ')', ':', '___EOS___']", "index": 529 }, { "content": " def write(self, oprot):\n if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n return\n oprot.writeStructBegin('TGetRuntimeProfileReq')\n if self.operationHandle is not None:\n oprot.writeFieldBegin('operationHandle', TType.STRUCT, 1)\n self.operationHandle.write(oprot)\n oprot.writeFieldEnd()\n if self.sessionHandle is not None:\n oprot.writeFieldBegin('sessionHandle', TType.STRUCT, 2)\n self.sessionHandle.write(oprot)\n oprot.writeFieldEnd()\n oprot.writeFieldStop()\n oprot.writeStructEnd()", "metadata": "root.TGetRuntimeProfileReq.write", "header": "['class', 'TGetRuntimeProfileReq', '(', 'object', ')', ':', '___EOS___']", "index": 555 }, { "content": " def validate(self):\n return", "metadata": "root.TGetRuntimeProfileReq.validate", "header": "['class', 'TGetRuntimeProfileReq', '(', 'object', ')', ':', '___EOS___']", "index": 571 }, { "content": " def __hash__(self):\n value = 17\n value = (value * 31) ^ hash(self.operationHandle)\n value = (value * 31) ^ hash(self.sessionHandle)\n return value", "metadata": "root.TGetRuntimeProfileReq.__hash__", "header": "['class', 'TGetRuntimeProfileReq', '(', 'object', ')', ':', '___EOS___']", "index": 575 }, { "content": " def __repr__(self):\n L = ['%s=%r' % (key, value)\n for key, value in self.__dict__.iteritems()]\n return '%s(%s)' % (self.__class__.__name__, ', '.join(L))", "metadata": "root.TGetRuntimeProfileReq.__repr__", "header": "['class', 'TGetRuntimeProfileReq', '(', 'object', ')', ':', '___EOS___']", "index": 581 }, { "content": " def __eq__(self, other):\n return isinstance(other, self.__class__) and self.__dict__ == other.__dict__", "metadata": "root.TGetRuntimeProfileReq.__eq__", "header": "['class', 'TGetRuntimeProfileReq', '(', 'object', ')', ':', '___EOS___']", "index": 586 }, { "content": " def __ne__(self, other):\n return not (self == other)", "metadata": "root.TGetRuntimeProfileReq.__ne__", "header": "['class', 'TGetRuntimeProfileReq', '(', 'object', ')', ':', '___EOS___']", "index": 589 }, { "content": "class TGetRuntimeProfileResp(object):\n \"\"\"\n Attributes:\n - status\n - profile\n \"\"\"\n\n thrift_spec = (\n None, # 0\n (1, TType.STRUCT, 'status', (TCLIService.ttypes.TStatus, TCLIService.ttypes.TStatus.thrift_spec), None, ), # 1\n (2, TType.STRING, 'profile', None, None, ), # 2\n )\n\n\n\n\n\n\n\n\n", "metadata": "root.TGetRuntimeProfileResp", "header": "['module', '___EOS___']", "index": 592 }, { "content": " def __init__(self, status=None, profile=None,):\n self.status = status\n self.profile = profile", "metadata": "root.TGetRuntimeProfileResp.__init__", "header": "['class', 'TGetRuntimeProfileResp', '(', 'object', ')', ':', '___EOS___']", "index": 605 }, { "content": " def read(self, iprot):\n if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n return\n iprot.readStructBegin()\n while True:\n (fname, ftype, fid) = iprot.readFieldBegin()\n if ftype == TType.STOP:\n break\n if fid == 1:\n if ftype == TType.STRUCT:\n self.status = TCLIService.ttypes.TStatus()\n self.status.read(iprot)\n else:\n iprot.skip(ftype)\n elif fid == 2:\n if ftype == TType.STRING:\n self.profile = iprot.readString()\n else:\n iprot.skip(ftype)\n else:\n iprot.skip(ftype)\n iprot.readFieldEnd()\n iprot.readStructEnd()", "metadata": "root.TGetRuntimeProfileResp.read", "header": "['class', 'TGetRuntimeProfileResp', '(', 'object', ')', ':', '___EOS___']", "index": 609 }, { "content": " def write(self, oprot):\n if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n return\n oprot.writeStructBegin('TGetRuntimeProfileResp')\n if self.status is not None:\n oprot.writeFieldBegin('status', TType.STRUCT, 1)\n self.status.write(oprot)\n oprot.writeFieldEnd()\n if self.profile is not None:\n oprot.writeFieldBegin('profile', TType.STRING, 2)\n oprot.writeString(self.profile)\n oprot.writeFieldEnd()\n oprot.writeFieldStop()\n oprot.writeStructEnd()", "metadata": "root.TGetRuntimeProfileResp.write", "header": "['class', 'TGetRuntimeProfileResp', '(', 'object', ')', ':', '___EOS___']", "index": 634 }, { "content": " def validate(self):\n if self.status is None:\n raise TProtocol.TProtocolException(message='Required field status is unset!')\n return", "metadata": "root.TGetRuntimeProfileResp.validate", "header": "['class', 'TGetRuntimeProfileResp', '(', 'object', ')', ':', '___EOS___']", "index": 650 }, { "content": " def __hash__(self):\n value = 17\n value = (value * 31) ^ hash(self.status)\n value = (value * 31) ^ hash(self.profile)\n return value", "metadata": "root.TGetRuntimeProfileResp.__hash__", "header": "['class', 'TGetRuntimeProfileResp', '(', 'object', ')', ':', '___EOS___']", "index": 656 }, { "content": " def __repr__(self):\n L = ['%s=%r' % (key, value)\n for key, value in self.__dict__.iteritems()]\n return '%s(%s)' % (self.__class__.__name__, ', '.join(L))", "metadata": "root.TGetRuntimeProfileResp.__repr__", "header": "['class', 'TGetRuntimeProfileResp', '(', 'object', ')', ':', '___EOS___']", "index": 662 }, { "content": " def __eq__(self, other):\n return isinstance(other, self.__class__) and self.__dict__ == other.__dict__", "metadata": "root.TGetRuntimeProfileResp.__eq__", "header": "['class', 'TGetRuntimeProfileResp', '(', 'object', ')', ':', '___EOS___']", "index": 667 }, { "content": " def __ne__(self, other):\n return not (self == other)", "metadata": "root.TGetRuntimeProfileResp.__ne__", "header": "['class', 'TGetRuntimeProfileResp', '(', 'object', ')', ':', '___EOS___']", "index": 670 } ]
[ { "span": "from thrift.Thrift import TType, TMessageType, TException, TApplicationException", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 80 }, { "span": "import Status.ttypes", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 20 }, { "span": "import Types.ttypes", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 19 }, { "span": "import beeswaxd.ttypes", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 22 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Auto", "generat", "ed", " ", "by", " ", "Thri", "ft", " ", "Compil", "er", " ", "(", "0.", "9.3", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "DO", " ", "NOT", " ", "EDIT", " ", "UNL", "ESS", " ", "YOU", " ", "ARE", " ", "SUR", "E", " ", "THA", "T", " ", "YOU", " ", "KN", "OW", " ", "WH", "AT", " ", "YOU", " ", "ARE", " ", "DOI", "NG_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "options", " ", "string", ":", " ", "py", ":", "new", "\\u", "style_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "thrift", "_", "._", "Thri", "ft_", "import_", "TT", "ype_", ",_", "TM", "essage", "Type_", ",_", "TE", "xcept", "ion_", ",_", "TA", "ppl", "ication", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Exe", "c", "Stats_", "._", "ttype", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Status_", "._", "ttype", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Types_", "._", "ttype", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "bee", "swa", "xd", "_", "._", "ttype", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "TCL", "IS", "ervice", "_", "._", "ttype", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "thrift", "_", "._", "transport_", "import_", "TT", "rans", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "thrift", "_", "._", "protocol_", "import_", "TB", "inary", "Protocol_", ",_", "TP", "roto", "col_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "thrift", "_", "._", "protocol_", "import_", "fastbinary_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fastbinary_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "TI", "mpa", "la", "Query", "Options_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ABORT", "\\u", "ON", "\\u", "ERROR_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAX", "\\u", "ERRORS", "_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DISABLE", "\\u", "CODE", "GEN", "_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BATCH", "\\u", "SIZE_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MEM", "\\u", "LIMIT_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NUM", "\\u", "NODES", "_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAX", "\\u", "SCAN", "\\u", "RANGE", "\\u", "LENGTH_", "=_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAX", "\\u", "IO", "\\u", "BUFF", "ERS_", "=_", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NUM", "\\u", "SCAN", "NER", "\\u", "THREADS", "_", "=_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ALLOW", "\\u", "UNSU", "PPO", "RTED", "\\u", "FORMATS_", "=_", "9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "ORDE", "R", "\\u", "BY", "\\u", "LIMIT_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEBU", "G", "\\u", "ACTION_", "=_", "11_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ABORT", "\\u", "ON", "\\u", "DEF", "AUL", "T", "\\u", "LIMIT", "\\u", "EXCE", "EDE", "D_", "=_", "12_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COMPRESS", "ION", "\\u", "CODE", "C_", "=_", "13_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SEQ", "\\u", "COMPRESS", "ION", "\\u", "MODE_", "=_", "14_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HB", "AS", "E", "\\u", "CAC", "HING", "_", "=_", "15_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HB", "AS", "E", "\\u", "CACHE", "\\u", "BLOCKS", "_", "=_", "16_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PAR", "QUE", "T", "\\u", "FILE", "\\u", "SIZE_", "=_", "17_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EXPL", "AIN", "\\u", "LEVEL_", "=_", "18_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SYNC", "\\u", "DD", "L_", "=_", "19_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "REQUEST", "\\u", "POOL", "_", "=_", "20_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "V", "\\u", "CPU", "\\u", "CORE", "S_", "=_", "21_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RESE", "RV", "ATION", "\\u", "REQUEST", "\\u", "TIMEOUT_", "=_", "22_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DISABLE", "\\u", "CACHE", "D", "\\u", "READ", "S_", "=_", "23_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DISABLE", "\\u", "OUTE", "RM", "OST", "\\u", "TOP", "N_", "=_", "24_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RM", "\\u", "INITIAL", "\\u", "MEM", "_", "=_", "25_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "QUE", "RY", "\\u", "TIME", "OUT", "\\u", "S_", "=_", "26_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAX", "\\u", "BLOCK", "\\u", "MG", "R", "\\u", "MEM", "ORY", "_", "=_", "27_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "APP", "X", "\\u", "COUNT", "\\u", "DIST", "INC", "T_", "=_", "28_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DISABLE", "\\u", "UNS", "AF", "E", "\\u", "SPI", "LL", "S_", "=_", "29_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EXEC", "\\u", "SINGLE", "\\u", "NODE", "\\u", "ROWS", "\\u", "THRESHOLD_", "=_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "VALU", "ES", "\\u", "TO", "\\u", "NAMES_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "\"", "ABORT", "\\u", "ON", "\\u", "ERROR", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "\"", "MAX", "\\u", "ERRORS", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "\"", "DISABLE", "\\u", "CODE", "GEN", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "3_", ":_", "\"", "BATCH", "\\u", "SIZE", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "4_", ":_", "\"", "MEM", "\\u", "LIMIT", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "5_", ":_", "\"", "NUM", "\\u", "NODES", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "6_", ":_", "\"", "MAX", "\\u", "SCAN", "\\u", "RANGE", "\\u", "LENGTH", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "7_", ":_", "\"", "MAX", "\\u", "IO", "\\u", "BUFF", "ERS", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "8_", ":_", "\"", "NUM", "\\u", "SCAN", "NER", "\\u", "THREADS", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "9_", ":_", "\"", "ALLOW", "\\u", "UNSU", "PPO", "RTED", "\\u", "FORMAT", "S", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "10_", ":_", "\"", "DEF", "AUL", "T", "\\u", "ORDE", "R", "\\u", "BY", "\\u", "LIMIT", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "11_", ":_", "\"", "DEBU", "G", "\\u", "ACTI", "ON", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "12_", ":_", "\"", "ABORT", "\\u", "ON", "\\u", "DEF", "AUL", "T", "\\u", "LIMIT", "\\u", "EXCE", "EDE", "D", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "13_", ":_", "\"", "COMPRESS", "ION", "\\u", "CODE", "C", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "14_", ":_", "\"", "SEQ", "\\u", "COMPRESS", "ION", "\\u", "MODE", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "15_", ":_", "\"", "HB", "AS", "E", "\\u", "CAC", "HING", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "16_", ":_", "\"", "HB", "AS", "E", "\\u", "CACHE", "\\u", "BLOCKS", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "17_", ":_", "\"", "PAR", "QUE", "T", "\\u", "FILE", "\\u", "SIZE", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "18_", ":_", "\"", "EXPL", "AIN", "\\u", "LE", "VEL", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "19_", ":_", "\"", "SYNC", "\\u", "DD", "L", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "20_", ":_", "\"", "REQUEST", "\\u", "POOL", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "21_", ":_", "\"", "V", "\\u", "CPU", "\\u", "CORE", "S", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "22_", ":_", "\"", "RESE", "RV", "ATION", "\\u", "REQUEST", "\\u", "TIME", "OUT", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "23_", ":_", "\"", "DISABLE", "\\u", "CACHE", "D", "\\u", "READ", "S", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "24_", ":_", "\"", "DISABLE", "\\u", "OUTE", "RM", "OST", "\\u", "TOP", "N", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "25_", ":_", "\"", "RM", "\\u", "INITIAL", "\\u", "MEM", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "26_", ":_", "\"", "QUE", "RY", "\\u", "TIME", "OUT", "\\u", "S", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "27_", ":_", "\"", "MAX", "\\u", "BLOCK", "\\u", "MG", "R", "\\u", "MEM", "ORY", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "28_", ":_", "\"", "APP", "X", "\\u", "COUNT", "\\u", "DIST", "INC", "T", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "29_", ":_", "\"", "DISABLE", "\\u", "UNS", "AF", "E", "\\u", "SPI", "LL", "S", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "30_", ":_", "\"", "EXEC", "\\u", "SINGLE", "\\u", "NODE", "\\u", "ROWS", "\\u", "THRESH", "OLD", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "NAMES", "\\u", "TO", "\\u", "VALUES_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ABORT", "\\u", "ON", "\\u", "ERROR", "\"_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "MAX", "\\u", "ERRORS", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "DISABLE", "\\u", "CODE", "GEN", "\"_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "BATCH", "\\u", "SIZE", "\"_", ":_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "MEM", "\\u", "LIMIT", "\"_", ":_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "NUM", "\\u", "NODES", "\"_", ":_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "MAX", "\\u", "SCAN", "\\u", "RANGE", "\\u", "LENGTH", "\"_", ":_", "6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "MAX", "\\u", "IO", "\\u", "BUFF", "ERS", "\"_", ":_", "7_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "NUM", "\\u", "SCAN", "NER", "\\u", "THREADS", "\"_", ":_", "8_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ALLOW", "\\u", "UNSU", "PPO", "RTED", "\\u", "FORMAT", "S", "\"_", ":_", "9_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "DEF", "AUL", "T", "\\u", "ORDE", "R", "\\u", "BY", "\\u", "LIMIT", "\"_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "DEBU", "G", "\\u", "ACTI", "ON", "\"_", ":_", "11_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ABORT", "\\u", "ON", "\\u", "DEF", "AUL", "T", "\\u", "LIMIT", "\\u", "EXCE", "EDE", "D", "\"_", ":_", "12_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "COMPRESS", "ION", "\\u", "CODE", "C", "\"_", ":_", "13_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "SEQ", "\\u", "COMPRESS", "ION", "\\u", "MODE", "\"_", ":_", "14_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "HB", "AS", "E", "\\u", "CAC", "HING", "\"_", ":_", "15_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "HB", "AS", "E", "\\u", "CACHE", "\\u", "BLOCKS", "\"_", ":_", "16_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "PAR", "QUE", "T", "\\u", "FILE", "\\u", "SIZE", "\"_", ":_", "17_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "EXPL", "AIN", "\\u", "LE", "VEL", "\"_", ":_", "18_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "SYNC", "\\u", "DD", "L", "\"_", ":_", "19_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "REQUEST", "\\u", "POOL", "\"_", ":_", "20_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "V", "\\u", "CPU", "\\u", "CORE", "S", "\"_", ":_", "21_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "RESE", "RV", "ATION", "\\u", "REQUEST", "\\u", "TIME", "OUT", "\"_", ":_", "22_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "DISABLE", "\\u", "CACHE", "D", "\\u", "READ", "S", "\"_", ":_", "23_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "DISABLE", "\\u", "OUTE", "RM", "OST", "\\u", "TOP", "N", "\"_", ":_", "24_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "RM", "\\u", "INITIAL", "\\u", "MEM", "\"_", ":_", "25_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "QUE", "RY", "\\u", "TIME", "OUT", "\\u", "S", "\"_", ":_", "26_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "MAX", "\\u", "BLOCK", "\\u", "MG", "R", "\\u", "MEM", "ORY", "\"_", ":_", "27_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "APP", "X", "\\u", "COUNT", "\\u", "DIST", "INC", "T", "\"_", ":_", "28_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "DISABLE", "\\u", "UNS", "AF", "E", "\\u", "SPI", "LL", "S", "\"_", ":_", "29_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "EXEC", "\\u", "SINGLE", "\\u", "NODE", "\\u", "ROWS", "\\u", "THRESH", "OLD", "\"_", ":_", "30_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "TI", "nse", "rt", "Result_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Attribute", "s", ":", "\\", "10", ";", " ", " ", " ", "-", " ", "rows", "\\u", "append", "ed", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "thrift", "\\u", "spec_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "#", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "TT", "ype_", "._", "MAP_", ",_", "'", "rows", "\\u", "append", "ed", "'_", ",_", "(_", "TT", "ype_", "._", "STRING_", ",_", "None_", ",_", "TT", "ype_", "._", "I64_", ",_", "None_", ")_", ",_", "None_", ",_", ")_", ",_", "#", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "TI", "nse", "rt", "Result_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "rows", "\\u", "append", "ed_", "=_", "None_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rows", "\\u", "append", "ed_", "=_", "rows", "\\u", "append", "ed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TI", "nse", "rt", "Result_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "iprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "iprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "isinstance_", "(_", "iprot_", "._", "trans_", ",_", "TT", "rans", "port_", "._", "CR", "ead", "able", "Transport_", ")_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fastbinary_", "._", "decode", "\\u", "binary_", "(_", "self_", ",_", "iprot_", "._", "trans_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "fname_", ",_", "ftype_", ",_", "fid_", ")_", "=_", "iprot_", "._", "read", "Field", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ftype_", "==_", "TT", "ype_", "._", "STOP_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fid_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "MAP_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rows", "\\u", "append", "ed_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "\\u", "kt", "ype", "1_", ",_", "\\u", "vty", "pe", "2_", ",_", "\\u", "size", "0_", ")_", "=_", "iprot_", "._", "read", "Map", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "i", "4_", "in_", "xrange_", "(_", "\\u", "size", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "key", "5_", "=_", "iprot_", "._", "read", "String_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "val", "6_", "=_", "iprot_", "._", "read", "I64_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rows", "\\u", "append", "ed_", "[_", "\\u", "key", "5_", "]_", "=_", "\\u", "val", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Map", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TI", "nse", "rt", "Result_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "oprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "oprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "trans_", "._", "write_", "(_", "fastbinary_", "._", "encode", "\\u", "binary_", "(_", "self_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "Begin_", "(_", "'", "TI", "nse", "rt", "Result", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "rows", "\\u", "append", "ed_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "rows", "\\u", "append", "ed", "'_", ",_", "TT", "ype_", "._", "MAP_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Map", "Begin_", "(_", "TT", "ype_", "._", "STRING_", ",_", "TT", "ype_", "._", "I64_", ",_", "len_", "(_", "self_", "._", "rows", "\\u", "append", "ed_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "kite", "r", "7_", ",_", "vite", "r", "8_", "in_", "self_", "._", "rows", "\\u", "append", "ed_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "String_", "(_", "kite", "r", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "I64_", "(_", "vite", "r", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Map", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Field", "Stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TI", "nse", "rt", "Result_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "rows", "\\u", "append", "ed_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "TP", "roto", "col_", "._", "TP", "roto", "col", "Exception_", "(_", "message_", "=_", "'", "Requ", "ired", " ", "field", " ", "rows", "\\u", "append", "ed", " ", "is", " ", "unse", "t", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TI", "nse", "rt", "Result_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "hash\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "17_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "rows", "\\u", "append", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TI", "nse", "rt", "Result_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "L_", "=_", "[_", "'%", "s", "=", "%", "r", "'_", "%_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "iteritems_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'%", "s", "(%", "s", ")'_", "%_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "',", " ", "'_", "._", "join_", "(_", "L_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TI", "nse", "rt", "Result_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "isinstance_", "(_", "other_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "and_", "self_", "._", "\\u\\u", "dict\\u\\u_", "==_", "other_", "._", "\\u\\u", "dict\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TI", "nse", "rt", "Result_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "(_", "self_", "==_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "TP", "ing", "Imp", "ala", "Service", "Resp_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Attribute", "s", ":", "\\", "10", ";", " ", " ", " ", "-", " ", "version", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "thrift", "\\u", "spec_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "#", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "TT", "ype_", "._", "STRING_", ",_", "'", "version", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "TP", "ing", "Imp", "ala", "Service", "Resp_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "version_", "=_", "None_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "version_", "=_", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TP", "ing", "Imp", "ala", "Service", "Resp_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "iprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "iprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "isinstance_", "(_", "iprot_", "._", "trans_", ",_", "TT", "rans", "port_", "._", "CR", "ead", "able", "Transport_", ")_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fastbinary_", "._", "decode", "\\u", "binary_", "(_", "self_", ",_", "iprot_", "._", "trans_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "fname_", ",_", "ftype_", ",_", "fid_", ")_", "=_", "iprot_", "._", "read", "Field", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ftype_", "==_", "TT", "ype_", "._", "STOP_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fid_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "version_", "=_", "iprot_", "._", "read", "String_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TP", "ing", "Imp", "ala", "Service", "Resp_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "oprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "oprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "trans_", "._", "write_", "(_", "fastbinary_", "._", "encode", "\\u", "binary_", "(_", "self_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "Begin_", "(_", "'", "TP", "ing", "Imp", "ala", "Service", "Resp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "version_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "version", "'_", ",_", "TT", "ype_", "._", "STRING_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "String_", "(_", "self_", "._", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Field", "Stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TP", "ing", "Imp", "ala", "Service", "Resp_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TP", "ing", "Imp", "ala", "Service", "Resp_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "hash\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "17_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TP", "ing", "Imp", "ala", "Service", "Resp_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "L_", "=_", "[_", "'%", "s", "=", "%", "r", "'_", "%_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "iteritems_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'%", "s", "(%", "s", ")'_", "%_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "',", " ", "'_", "._", "join_", "(_", "L_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TP", "ing", "Imp", "ala", "Service", "Resp_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "isinstance_", "(_", "other_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "and_", "self_", "._", "\\u\\u", "dict\\u\\u_", "==_", "other_", "._", "\\u\\u", "dict\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TP", "ing", "Imp", "ala", "Service", "Resp_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "(_", "self_", "==_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "TR", "ese", "t", "Table", "Req_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Attribute", "s", ":", "\\", "10", ";", " ", " ", " ", "-", " ", "db", "\\u", "name", "\\", "10", ";", " ", " ", " ", "-", " ", "table", "\\u", "name", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "thrift", "\\u", "spec_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "#", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "TT", "ype_", "._", "STRING_", ",_", "'", "db", "\\u", "name", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "TT", "ype_", "._", "STRING_", ",_", "'", "table", "\\u", "name", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "TR", "ese", "t", "Table", "Req_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "db", "\\u", "name_", "=_", "None_", ",_", "table", "\\u", "name_", "=_", "None_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "db", "\\u", "name_", "=_", "db", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "table", "\\u", "name_", "=_", "table", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TR", "ese", "t", "Table", "Req_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "iprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "iprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "isinstance_", "(_", "iprot_", "._", "trans_", ",_", "TT", "rans", "port_", "._", "CR", "ead", "able", "Transport_", ")_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fastbinary_", "._", "decode", "\\u", "binary_", "(_", "self_", ",_", "iprot_", "._", "trans_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "fname_", ",_", "ftype_", ",_", "fid_", ")_", "=_", "iprot_", "._", "read", "Field", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ftype_", "==_", "TT", "ype_", "._", "STOP_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fid_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "db", "\\u", "name_", "=_", "iprot_", "._", "read", "String_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "table", "\\u", "name_", "=_", "iprot_", "._", "read", "String_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TR", "ese", "t", "Table", "Req_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "oprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "oprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "trans_", "._", "write_", "(_", "fastbinary_", "._", "encode", "\\u", "binary_", "(_", "self_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "Begin_", "(_", "'", "TR", "ese", "t", "Table", "Re", "q", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "db", "\\u", "name_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "db", "\\u", "name", "'_", ",_", "TT", "ype_", "._", "STRING_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "String_", "(_", "self_", "._", "db", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "table", "\\u", "name_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "table", "\\u", "name", "'_", ",_", "TT", "ype_", "._", "STRING_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "String_", "(_", "self_", "._", "table", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Field", "Stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TR", "ese", "t", "Table", "Req_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "db", "\\u", "name_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "TP", "roto", "col_", "._", "TP", "roto", "col", "Exception_", "(_", "message_", "=_", "'", "Requ", "ired", " ", "field", " ", "db", "\\u", "name", " ", "is", " ", "unse", "t", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "table", "\\u", "name_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "TP", "roto", "col_", "._", "TP", "roto", "col", "Exception_", "(_", "message_", "=_", "'", "Requ", "ired", " ", "field", " ", "table", "\\u", "name", " ", "is", " ", "unse", "t", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TR", "ese", "t", "Table", "Req_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "hash\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "17_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "db", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "table", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TR", "ese", "t", "Table", "Req_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "L_", "=_", "[_", "'%", "s", "=", "%", "r", "'_", "%_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "iteritems_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'%", "s", "(%", "s", ")'_", "%_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "',", " ", "'_", "._", "join_", "(_", "L_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TR", "ese", "t", "Table", "Req_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "isinstance_", "(_", "other_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "and_", "self_", "._", "\\u\\u", "dict\\u\\u_", "==_", "other_", "._", "\\u\\u", "dict\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TR", "ese", "t", "Table", "Req_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "(_", "self_", "==_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "TG", "et", "Exe", "c", "Summ", "ary", "Req_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Attribute", "s", ":", "\\", "10", ";", " ", " ", " ", "-", " ", "operati", "on", "Handle", "\\", "10", ";", " ", " ", " ", "-", " ", "session", "Handle", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "thrift", "\\u", "spec_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "#", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "TT", "ype_", "._", "STRUCT_", ",_", "'", "operati", "on", "Handle", "'_", ",_", "(_", "TCL", "IS", "ervice", "_", "._", "ttype", "s_", "._", "TO", "perat", "ion", "Handle_", ",_", "TCL", "IS", "ervice", "_", "._", "ttype", "s_", "._", "TO", "perat", "ion", "Handle_", "._", "thrift", "\\u", "spec_", ")_", ",_", "None_", ",_", ")_", ",_", "#", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "TT", "ype_", "._", "STRUCT_", ",_", "'", "session", "Handle", "'_", ",_", "(_", "TCL", "IS", "ervice", "_", "._", "ttype", "s_", "._", "TS", "ession", "Handle_", ",_", "TCL", "IS", "ervice", "_", "._", "ttype", "s_", "._", "TS", "ession", "Handle_", "._", "thrift", "\\u", "spec_", ")_", ",_", "None_", ",_", ")_", ",_", "#", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Exe", "c", "Summ", "ary", "Req_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "operati", "on", "Handle_", "=_", "None_", ",_", "session", "Handle_", "=_", "None_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "operati", "on", "Handle_", "=_", "operati", "on", "Handle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session", "Handle_", "=_", "session", "Handle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Exe", "c", "Summ", "ary", "Req_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "iprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "iprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "isinstance_", "(_", "iprot_", "._", "trans_", ",_", "TT", "rans", "port_", "._", "CR", "ead", "able", "Transport_", ")_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fastbinary_", "._", "decode", "\\u", "binary_", "(_", "self_", ",_", "iprot_", "._", "trans_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "fname_", ",_", "ftype_", ",_", "fid_", ")_", "=_", "iprot_", "._", "read", "Field", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ftype_", "==_", "TT", "ype_", "._", "STOP_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fid_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRUCT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "operati", "on", "Handle_", "=_", "TCL", "IS", "ervice", "_", "._", "ttype", "s_", "._", "TO", "perat", "ion", "Handle_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "operati", "on", "Handle_", "._", "read_", "(_", "iprot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRUCT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session", "Handle_", "=_", "TCL", "IS", "ervice", "_", "._", "ttype", "s_", "._", "TS", "ession", "Handle_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session", "Handle_", "._", "read_", "(_", "iprot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Exe", "c", "Summ", "ary", "Req_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "oprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "oprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "trans_", "._", "write_", "(_", "fastbinary_", "._", "encode", "\\u", "binary_", "(_", "self_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "Begin_", "(_", "'", "TG", "et", "Exe", "c", "Summ", "ary", "Re", "q", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "operati", "on", "Handle_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "operati", "on", "Handle", "'_", ",_", "TT", "ype_", "._", "STRUCT_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "operati", "on", "Handle_", "._", "write_", "(_", "oprot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "session", "Handle_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "session", "Handle", "'_", ",_", "TT", "ype_", "._", "STRUCT_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session", "Handle_", "._", "write_", "(_", "oprot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Field", "Stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Exe", "c", "Summ", "ary", "Req_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Exe", "c", "Summ", "ary", "Req_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "hash\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "17_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "operati", "on", "Handle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "session", "Handle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Exe", "c", "Summ", "ary", "Req_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "L_", "=_", "[_", "'%", "s", "=", "%", "r", "'_", "%_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "iteritems_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'%", "s", "(%", "s", ")'_", "%_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "',", " ", "'_", "._", "join_", "(_", "L_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Exe", "c", "Summ", "ary", "Req_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "isinstance_", "(_", "other_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "and_", "self_", "._", "\\u\\u", "dict\\u\\u_", "==_", "other_", "._", "\\u\\u", "dict\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Exe", "c", "Summ", "ary", "Req_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "(_", "self_", "==_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "TG", "et", "Exe", "c", "Summ", "ary", "Resp_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Attribute", "s", ":", "\\", "10", ";", " ", " ", " ", "-", " ", "status", "\\", "10", ";", " ", " ", " ", "-", " ", "summar", "y", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "thrift", "\\u", "spec_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "#", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "TT", "ype_", "._", "STRUCT_", ",_", "'", "status", "'_", ",_", "(_", "TCL", "IS", "ervice", "_", "._", "ttype", "s_", "._", "TS", "tatus_", ",_", "TCL", "IS", "ervice", "_", "._", "ttype", "s_", "._", "TS", "tatus_", "._", "thrift", "\\u", "spec_", ")_", ",_", "None_", ",_", ")_", ",_", "#", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "TT", "ype_", "._", "STRUCT_", ",_", "'", "summar", "y", "'_", ",_", "(_", "Exe", "c", "Stats_", "._", "ttype", "s_", "._", "TE", "xec", "Summary_", ",_", "Exe", "c", "Stats_", "._", "ttype", "s_", "._", "TE", "xec", "Summary_", "._", "thrift", "\\u", "spec_", ")_", ",_", "None_", ",_", ")_", ",_", "#", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Exe", "c", "Summ", "ary", "Resp_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "status_", "=_", "None_", ",_", "summary_", "=_", "None_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "status_", "=_", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "summary_", "=_", "summary_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Exe", "c", "Summ", "ary", "Resp_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "iprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "iprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "isinstance_", "(_", "iprot_", "._", "trans_", ",_", "TT", "rans", "port_", "._", "CR", "ead", "able", "Transport_", ")_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fastbinary_", "._", "decode", "\\u", "binary_", "(_", "self_", ",_", "iprot_", "._", "trans_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "fname_", ",_", "ftype_", ",_", "fid_", ")_", "=_", "iprot_", "._", "read", "Field", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ftype_", "==_", "TT", "ype_", "._", "STOP_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fid_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRUCT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "status_", "=_", "TCL", "IS", "ervice", "_", "._", "ttype", "s_", "._", "TS", "tatus_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "status_", "._", "read_", "(_", "iprot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRUCT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "summary_", "=_", "Exe", "c", "Stats_", "._", "ttype", "s_", "._", "TE", "xec", "Summary_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "summary_", "._", "read_", "(_", "iprot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Exe", "c", "Summ", "ary", "Resp_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "oprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "oprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "trans_", "._", "write_", "(_", "fastbinary_", "._", "encode", "\\u", "binary_", "(_", "self_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "Begin_", "(_", "'", "TG", "et", "Exe", "c", "Summ", "ary", "Resp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "status_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "status", "'_", ",_", "TT", "ype_", "._", "STRUCT_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "status_", "._", "write_", "(_", "oprot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "summary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "summar", "y", "'_", ",_", "TT", "ype_", "._", "STRUCT_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "summary_", "._", "write_", "(_", "oprot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Field", "Stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Exe", "c", "Summ", "ary", "Resp_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "status_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "TP", "roto", "col_", "._", "TP", "roto", "col", "Exception_", "(_", "message_", "=_", "'", "Requ", "ired", " ", "field", " ", "status", " ", "is", " ", "unse", "t", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Exe", "c", "Summ", "ary", "Resp_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "hash\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "17_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "summary_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Exe", "c", "Summ", "ary", "Resp_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "L_", "=_", "[_", "'%", "s", "=", "%", "r", "'_", "%_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "iteritems_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'%", "s", "(%", "s", ")'_", "%_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "',", " ", "'_", "._", "join_", "(_", "L_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Exe", "c", "Summ", "ary", "Resp_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "isinstance_", "(_", "other_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "and_", "self_", "._", "\\u\\u", "dict\\u\\u_", "==_", "other_", "._", "\\u\\u", "dict\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Exe", "c", "Summ", "ary", "Resp_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "(_", "self_", "==_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "TG", "et", "Run", "time", "Profil", "e", "Req_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Attribute", "s", ":", "\\", "10", ";", " ", " ", " ", "-", " ", "operati", "on", "Handle", "\\", "10", ";", " ", " ", " ", "-", " ", "session", "Handle", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "thrift", "\\u", "spec_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "#", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "TT", "ype_", "._", "STRUCT_", ",_", "'", "operati", "on", "Handle", "'_", ",_", "(_", "TCL", "IS", "ervice", "_", "._", "ttype", "s_", "._", "TO", "perat", "ion", "Handle_", ",_", "TCL", "IS", "ervice", "_", "._", "ttype", "s_", "._", "TO", "perat", "ion", "Handle_", "._", "thrift", "\\u", "spec_", ")_", ",_", "None_", ",_", ")_", ",_", "#", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "TT", "ype_", "._", "STRUCT_", ",_", "'", "session", "Handle", "'_", ",_", "(_", "TCL", "IS", "ervice", "_", "._", "ttype", "s_", "._", "TS", "ession", "Handle_", ",_", "TCL", "IS", "ervice", "_", "._", "ttype", "s_", "._", "TS", "ession", "Handle_", "._", "thrift", "\\u", "spec_", ")_", ",_", "None_", ",_", ")_", ",_", "#", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Run", "time", "Profil", "e", "Req_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "operati", "on", "Handle_", "=_", "None_", ",_", "session", "Handle_", "=_", "None_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "operati", "on", "Handle_", "=_", "operati", "on", "Handle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session", "Handle_", "=_", "session", "Handle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Run", "time", "Profil", "e", "Req_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "iprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "iprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "isinstance_", "(_", "iprot_", "._", "trans_", ",_", "TT", "rans", "port_", "._", "CR", "ead", "able", "Transport_", ")_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fastbinary_", "._", "decode", "\\u", "binary_", "(_", "self_", ",_", "iprot_", "._", "trans_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "fname_", ",_", "ftype_", ",_", "fid_", ")_", "=_", "iprot_", "._", "read", "Field", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ftype_", "==_", "TT", "ype_", "._", "STOP_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fid_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRUCT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "operati", "on", "Handle_", "=_", "TCL", "IS", "ervice", "_", "._", "ttype", "s_", "._", "TO", "perat", "ion", "Handle_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "operati", "on", "Handle_", "._", "read_", "(_", "iprot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRUCT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session", "Handle_", "=_", "TCL", "IS", "ervice", "_", "._", "ttype", "s_", "._", "TS", "ession", "Handle_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session", "Handle_", "._", "read_", "(_", "iprot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Run", "time", "Profil", "e", "Req_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "oprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "oprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "trans_", "._", "write_", "(_", "fastbinary_", "._", "encode", "\\u", "binary_", "(_", "self_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "Begin_", "(_", "'", "TG", "et", "Run", "time", "Profil", "e", "Re", "q", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "operati", "on", "Handle_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "operati", "on", "Handle", "'_", ",_", "TT", "ype_", "._", "STRUCT_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "operati", "on", "Handle_", "._", "write_", "(_", "oprot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "session", "Handle_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "session", "Handle", "'_", ",_", "TT", "ype_", "._", "STRUCT_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session", "Handle_", "._", "write_", "(_", "oprot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Field", "Stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Run", "time", "Profil", "e", "Req_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Run", "time", "Profil", "e", "Req_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "hash\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "17_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "operati", "on", "Handle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "session", "Handle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Run", "time", "Profil", "e", "Req_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "L_", "=_", "[_", "'%", "s", "=", "%", "r", "'_", "%_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "iteritems_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'%", "s", "(%", "s", ")'_", "%_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "',", " ", "'_", "._", "join_", "(_", "L_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Run", "time", "Profil", "e", "Req_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "isinstance_", "(_", "other_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "and_", "self_", "._", "\\u\\u", "dict\\u\\u_", "==_", "other_", "._", "\\u\\u", "dict\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Run", "time", "Profil", "e", "Req_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "(_", "self_", "==_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "TG", "et", "Run", "time", "Profil", "e", "Resp_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Attribute", "s", ":", "\\", "10", ";", " ", " ", " ", "-", " ", "status", "\\", "10", ";", " ", " ", " ", "-", " ", "profile", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "thrift", "\\u", "spec_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "#", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "TT", "ype_", "._", "STRUCT_", ",_", "'", "status", "'_", ",_", "(_", "TCL", "IS", "ervice", "_", "._", "ttype", "s_", "._", "TS", "tatus_", ",_", "TCL", "IS", "ervice", "_", "._", "ttype", "s_", "._", "TS", "tatus_", "._", "thrift", "\\u", "spec_", ")_", ",_", "None_", ",_", ")_", ",_", "#", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "TT", "ype_", "._", "STRING_", ",_", "'", "profile", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Run", "time", "Profil", "e", "Resp_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "status_", "=_", "None_", ",_", "profile_", "=_", "None_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "status_", "=_", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "profile_", "=_", "profile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Run", "time", "Profil", "e", "Resp_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "iprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "iprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "isinstance_", "(_", "iprot_", "._", "trans_", ",_", "TT", "rans", "port_", "._", "CR", "ead", "able", "Transport_", ")_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fastbinary_", "._", "decode", "\\u", "binary_", "(_", "self_", ",_", "iprot_", "._", "trans_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "fname_", ",_", "ftype_", ",_", "fid_", ")_", "=_", "iprot_", "._", "read", "Field", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ftype_", "==_", "TT", "ype_", "._", "STOP_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fid_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRUCT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "status_", "=_", "TCL", "IS", "ervice", "_", "._", "ttype", "s_", "._", "TS", "tatus_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "status_", "._", "read_", "(_", "iprot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "profile_", "=_", "iprot_", "._", "read", "String_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Run", "time", "Profil", "e", "Resp_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "oprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "oprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "trans_", "._", "write_", "(_", "fastbinary_", "._", "encode", "\\u", "binary_", "(_", "self_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "Begin_", "(_", "'", "TG", "et", "Run", "time", "Profil", "e", "Resp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "status_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "status", "'_", ",_", "TT", "ype_", "._", "STRUCT_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "status_", "._", "write_", "(_", "oprot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "profile_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "profile", "'_", ",_", "TT", "ype_", "._", "STRING_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "String_", "(_", "self_", "._", "profile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Field", "Stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Run", "time", "Profil", "e", "Resp_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "status_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "TP", "roto", "col_", "._", "TP", "roto", "col", "Exception_", "(_", "message_", "=_", "'", "Requ", "ired", " ", "field", " ", "status", " ", "is", " ", "unse", "t", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Run", "time", "Profil", "e", "Resp_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "hash\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "17_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "profile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Run", "time", "Profil", "e", "Resp_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "L_", "=_", "[_", "'%", "s", "=", "%", "r", "'_", "%_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "iteritems_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'%", "s", "(%", "s", ")'_", "%_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "',", " ", "'_", "._", "join_", "(_", "L_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Run", "time", "Profil", "e", "Resp_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "isinstance_", "(_", "other_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "and_", "self_", "._", "\\u\\u", "dict\\u\\u_", "==_", "other_", "._", "\\u\\u", "dict\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TG", "et", "Run", "time", "Profil", "e", "Resp_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "(_", "self_", "==_", "other_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
samluescher/django-form-designer/form_designer/migrations/0009_set_data_to_form_log.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom form_designer.settings import VALUE_PICKLEFIELD\nDATA_FIELD_TYPE = 'picklefield.fields.PickledObjectField' if VALUE_PICKLEFIELD else 'django.db.models.fields.TextField'\n\nimport datetime\nfrom south.db import db\nfrom south.v2 import DataMigration\nfrom django.db import models\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(DataMigration):\n\n\n\n models = {\n 'auth.group': {\n 'Meta': {'object_name': 'Group'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),\n 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': \"orm['auth.Permission']\", 'symmetrical': 'False', 'blank': 'True'})\n },\n 'auth.permission': {\n 'Meta': {'ordering': \"('content_type__app_label', 'content_type__model', 'codename')\", 'unique_together': \"(('content_type', 'codename'),)\", 'object_name': 'Permission'},\n 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['contenttypes.ContentType']\"}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})\n },\n 'auth.user': {\n 'Meta': {'object_name': 'User'},\n 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),\n 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),\n 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),\n 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': \"orm['auth.Group']\", 'symmetrical': 'False', 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),\n 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),\n 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),\n 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': \"orm['auth.Permission']\", 'symmetrical': 'False', 'blank': 'True'}),\n 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})\n },\n 'contenttypes.contenttype': {\n 'Meta': {'ordering': \"('name',)\", 'unique_together': \"(('app_label', 'model'),)\", 'object_name': 'ContentType', 'db_table': \"'django_content_type'\"},\n 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})\n },\n 'form_designer.formdefinition': {\n 'Meta': {'object_name': 'FormDefinition'},\n 'action': ('django.db.models.fields.URLField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),\n 'allow_get_initial': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'body': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n 'display_logged': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'error_message': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),\n 'form_template_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'log_data': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'mail_from': ('form_designer.fields.TemplateCharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),\n 'mail_subject': ('form_designer.fields.TemplateCharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),\n 'mail_to': ('form_designer.fields.TemplateCharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),\n 'mail_uploaded_files': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'message_template': ('form_designer.fields.TemplateTextField', [], {'null': 'True', 'blank': 'True'}),\n 'method': ('django.db.models.fields.CharField', [], {'default': \"'POST'\", 'max_length': '10'}),\n 'name': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255'}),\n 'private_hash': ('django.db.models.fields.CharField', [], {'default': \"''\", 'max_length': '40'}),\n 'public_hash': ('django.db.models.fields.CharField', [], {'default': \"''\", 'max_length': '40'}),\n 'require_hash': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'save_uploaded_files': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'submit_label': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),\n 'success_clear': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'success_message': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),\n 'success_redirect': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'})\n },\n 'form_designer.formdefinitionfield': {\n 'Meta': {'ordering': \"['position']\", 'object_name': 'FormDefinitionField'},\n 'choice_labels': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n 'choice_model': ('form_designer.fields.ModelNameField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),\n 'choice_model_empty_label': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),\n 'choice_values': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n 'decimal_places': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'field_class': ('django.db.models.fields.CharField', [], {'max_length': '32'}),\n 'form_definition': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['form_designer.FormDefinition']\"}),\n 'help_text': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'include_result': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'initial': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n 'label': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),\n 'max_digits': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'max_length': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'max_value': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),\n 'min_length': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'min_value': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),\n 'name': ('django.db.models.fields.SlugField', [], {'max_length': '255'}),\n 'position': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'regex': ('form_designer.fields.RegexpExpressionField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),\n 'required': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'widget': ('django.db.models.fields.CharField', [], {'default': \"''\", 'max_length': '255', 'null': 'True', 'blank': 'True'})\n },\n 'form_designer.formlog': {\n 'Meta': {'object_name': 'FormLog'},\n 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),\n 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['auth.User']\", 'null': 'True', 'blank': 'True'}),\n 'form_definition': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'logs'\", 'to': \"orm['form_designer.FormDefinition']\"}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})\n },\n 'form_designer.formvalue': {\n 'Meta': {'object_name': 'FormValue'},\n 'field_name': ('django.db.models.fields.SlugField', [], {'max_length': '255'}),\n 'form_log': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'values'\", 'to': \"orm['form_designer.FormLog']\"}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'value': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'})\n }\n }\n\n complete_apps = ['form_designer']\n symmetrical = True", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 9 }, { "content": " def forwards(self, orm):\n if VALUE_PICKLEFIELD:\n from picklefield.fields import PickledObjectField\n tmp_data = PickledObjectField(null=True, blank=True)\n else:\n tmp_data = models.TextField(null=True, blank=True)\n tmp_data.contribute_to_class(orm['form_designer.FormLog'], 'tmp_data')\n\n for log in orm['form_designer.FormLog'].objects.all():\n log.set_data(log.tmp_data)\n log.save()\n\n # Deleting field 'FormLog.data'\n db.delete_column('form_designer_formlog', 'tmp_data')", "metadata": "root.Migration.forwards", "header": "['class', 'Migration', '(', 'DataMigration', ')', ':', '___EOS___']", "index": 11 }, { "content": " def backwards(self, orm):\n for log in orm['form_designer.FormLog'].objects.all():\n log.data = log.get_data()\n raise Exception(log.data)\n log.save()", "metadata": "root.Migration.backwards", "header": "['class', 'Migration', '(', 'DataMigration', ')', ':', '___EOS___']", "index": 26 } ]
[ { "span": "import datetime", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 15 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "form", "\\u", "designer", "_", "._", "settings_", "import_", "VALU", "E", "\\u", "PIC", "KL", "EFI", "EL", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DATA", "\\u", "FIE", "LD", "\\u", "TYPE_", "=_", "'", "pickle", "field", ".", "fields", ".", "Pickl", "ed", "Object", "Field", "'_", "if_", "VALU", "E", "\\u", "PIC", "KL", "EFI", "EL", "D_", "else_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "db_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "v2_", "import_", "Data", "Migration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Migration_", "(_", "Data", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "models_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", ".", "group", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Group", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "80", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "permissi", "ons", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "Permi", "ssion", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", ".", "permissi", "on", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "content", "\\u", "type\\u\\u", "app", "\\u", "label", "',", " ", "'", "content", "\\u", "type\\u\\u", "model", "',", " ", "'", "code", "name", "')\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "content", "\\u", "type", "',", " ", "'", "code", "name", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Permi", "ssion", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "code", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", ".", "user", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "User", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "\\u", "joine", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", ".", "now", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Ema", "il", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "7", "5", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "first", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "group", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "Group", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "active", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "sta", "ff", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "super", "user", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "login", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", ".", "now", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "permissi", "ons", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "Permi", "ssion", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "contenttype", "s", ".", "contenttype", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "name", "',)\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "app", "\\u", "label", "',", " ", "'", "model", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Conten", "t", "Type", "'_", ",_", "'", "db", "\\u", "table", "'_", ":_", "\"'", "django", "\\u", "content", "\\u", "type", "'\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "label", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "model", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "\\u", "designer", ".", "form", "definit", "ion", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Form", "Definit", "ion", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "action", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "URL", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "allow", "\\u", "get", "\\u", "initial", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "display", "\\u", "logged", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "\\u", "message", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "\\u", "template", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "log", "\\u", "data", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mail", "\\u", "from", "'_", ":_", "(_", "'", "form", "\\u", "designer", ".", "fields", ".", "Templa", "te", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mail", "\\u", "subject", "'_", ":_", "(_", "'", "form", "\\u", "designer", ".", "fields", ".", "Templa", "te", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mail", "\\u", "to", "'_", ":_", "(_", "'", "form", "\\u", "designer", ".", "fields", ".", "Templa", "te", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mail", "\\u", "uploade", "d\\u", "files", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "\\u", "template", "'_", ":_", "(_", "'", "form", "\\u", "designer", ".", "fields", ".", "Templa", "te", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "POST", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "10", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Sl", "ug", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "private", "\\u", "hash", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "40", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "public", "\\u", "hash", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "40", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "require", "\\u", "hash", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "save", "\\u", "uploade", "d\\u", "files", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "submit", "\\u", "label", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "success", "\\u", "clear", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "success", "\\u", "message", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "success", "\\u", "redirec", "t", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "\\u", "designer", ".", "form", "definit", "ion", "field", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"[", "'", "position", "']\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Form", "Definit", "ion", "Field", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "choice", "\\u", "labels", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "choice", "\\u", "model", "'_", ":_", "(_", "'", "form", "\\u", "designer", ".", "fields", ".", "Model", "Name", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "choice", "\\u", "model", "\\u", "empty", "\\u", "label", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "choice", "\\u", "values", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "decima", "l\\u", "place", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "field", "\\u", "class", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "32", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "\\u", "definit", "ion", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "form", "\\u", "designer", ".", "Form", "Definit", "ion", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "help", "\\u", "text", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "include", "\\u", "result", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "initial", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "label", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "\\u", "digit", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "\\u", "length", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "\\u", "value", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Float", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "min", "\\u", "length", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "min", "\\u", "value", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Float", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Sl", "ug", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "position", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "regex", "'_", ":_", "(_", "'", "form", "\\u", "designer", ".", "fields", ".", "Rege", "xp", "Expression", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "require", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "widget", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "\\u", "designer", ".", "form", "log", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Form", "Log", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "\\u", "by", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "User", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "\\u", "definit", "ion", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "logs", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "form", "\\u", "designer", ".", "Form", "Definit", "ion", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "\\u", "designer", ".", "form", "value", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Form", "Value", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "field", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Sl", "ug", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "\\u", "log", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "values", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "form", "\\u", "designer", ".", "Form", "Log", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "\\u", "apps_", "=_", "[_", "'", "form", "\\u", "designer", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "symmetric", "al_", "=_", "True_", "[SEP]_", "class_", "Migration_", "(_", "Data", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "forwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "VALU", "E", "\\u", "PIC", "KL", "EFI", "EL", "D_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "pickle", "field_", "._", "fields_", "import_", "Pickl", "ed", "Object", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "\\u", "data_", "=_", "Pickl", "ed", "Object", "Field_", "(_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmp", "\\u", "data_", "=_", "models_", "._", "Text", "Field_", "(_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmp", "\\u", "data_", "._", "contribute", "\\u", "to", "\\u", "class_", "(_", "orm_", "[_", "'", "form", "\\u", "designer", ".", "Form", "Log", "'_", "]_", ",_", "'", "tmp", "\\u", "data", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "log_", "in_", "orm_", "[_", "'", "form", "\\u", "designer", ".", "Form", "Log", "'_", "]_", "._", "objects_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "set\\u", "data_", "(_", "log_", "._", "tmp", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "field", " ", "'", "Form", "Log", ".", "data", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "delete", "\\u", "column_", "(_", "'", "form", "\\u", "designer", "\\u", "form", "log", "'_", ",_", "'", "tmp", "\\u", "data", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Migration_", "(_", "Data", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "backwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "log_", "in_", "orm_", "[_", "'", "form", "\\u", "designer", ".", "Form", "Log", "'_", "]_", "._", "objects_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
charanpald/APGL/apgl/graph/test/GraphUtilsTest.py
[ { "content": " def testVertexLabelPairs(self):\n numVertices = 6\n numFeatures = 1\n vList = VertexList(numVertices, numFeatures)\n vList.setVertices(numpy.array([numpy.arange(0, 6)]).T)\n\n graph = DenseGraph(vList, True)\n graph.addEdge(0, 1, 0.1)\n graph.addEdge(1, 3, 0.1)\n graph.addEdge(0, 2, 0.2)\n graph.addEdge(2, 3, 0.5)\n graph.addEdge(0, 4, 0.1)\n graph.addEdge(3, 4, 0.1)\n\n tol = 10**-6\n edges = graph.getAllEdges()\n\n X = GraphUtils.vertexLabelPairs(graph, edges)\n self.assertTrue(numpy.linalg.norm(X - edges) < tol )\n\n\n X = GraphUtils.vertexLabelPairs(graph, edges[[5, 2, 1], :])\n self.assertTrue(numpy.linalg.norm(X - edges[[5,2,1], :]) < tol )\n\n #Try a bigger graph\n numVertices = 6\n numFeatures = 2\n vList = VertexList(numVertices, numFeatures)\n vList.setVertices(numpy.random.randn(numVertices, numFeatures))\n\n graph = DenseGraph(vList, True)\n graph.addEdge(0, 1, 0.1)\n graph.addEdge(1, 3, 0.1)\n\n edges = graph.getAllEdges()\n\n X = GraphUtils.vertexLabelPairs(graph, edges)\n self.assertTrue(numpy.linalg.norm(X[0, 0:numFeatures] - vList.getVertex(1)) < tol )\n self.assertTrue(numpy.linalg.norm(X[0, numFeatures:numFeatures*2] - vList.getVertex(0)) < tol )\n self.assertTrue(numpy.linalg.norm(X[1, 0:numFeatures] - vList.getVertex(3)) < tol )\n self.assertTrue(numpy.linalg.norm(X[1, numFeatures:numFeatures*2] - vList.getVertex(1)) < tol )\n\n #Try directed graphs\n graph = DenseGraph(vList, False)\n graph.addEdge(0, 1, 0.1)\n graph.addEdge(1, 3, 0.1)\n\n edges = graph.getAllEdges()\n\n X = GraphUtils.vertexLabelPairs(graph, edges)\n self.assertTrue(numpy.linalg.norm(X[0, 0:numFeatures] - vList.getVertex(0)) < tol )\n self.assertTrue(numpy.linalg.norm(X[0, numFeatures:numFeatures*2] - vList.getVertex(1)) < tol )\n self.assertTrue(numpy.linalg.norm(X[1, 0:numFeatures] - vList.getVertex(1)) < tol )\n self.assertTrue(numpy.linalg.norm(X[1, numFeatures:numFeatures*2] - vList.getVertex(3)) < tol )", "metadata": "root.AbstractMatrixGraphTest.testVertexLabelPairs", "header": "['class', 'AbstractMatrixGraphTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 37 }, { "content": " def testShiftLaplacian(self):\n numVertices = 10\n numFeatures = 0\n\n vList = VertexList(numVertices, numFeatures)\n graph = SparseGraph(vList)\n\n ell = 2\n m = 2\n generator = BarabasiAlbertGenerator(ell, m)\n graph = generator.generate(graph)\n\n k = 10\n W = graph.getSparseWeightMatrix()\n L = GraphUtils.shiftLaplacian(W)\n\n L2 = 2*numpy.eye(numVertices) - graph.normalisedLaplacianSym()\n\n tol = 10**-6\n self.assertTrue(numpy.linalg.norm(L - L2) < tol)", "metadata": "root.AbstractMatrixGraphTest.testShiftLaplacian", "header": "['class', 'AbstractMatrixGraphTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 171 }, { "content": " def testNormalisedLaplacianSym(self):\n numVertices = 10\n numFeatures = 0\n\n vList = VertexList(numVertices, numFeatures)\n graph = SparseGraph(vList)\n\n ell = 2\n m = 2\n generator = BarabasiAlbertGenerator(ell, m)\n graph = generator.generate(graph)\n\n k = 10\n W = graph.getSparseWeightMatrix()\n L = GraphUtils.shiftLaplacian(W)\n\n L2 = graph.normalisedLaplacianSym()\n\n tol = 10**-6\n self.assertTrue(numpy.linalg.norm(L + L2 - 2*numpy.eye(numVertices)) < tol)\n\n #Test zero rows/cols \n W = scipy.sparse.csr_matrix((5, 5))\n W[1, 0] = 1\n W[0, 1] = 1\n L = GraphUtils.normalisedLaplacianSym(W)\n \n for i in range(2, 5): \n self.assertEquals(L[i, i], 0)", "metadata": "root.AbstractMatrixGraphTest.testNormalisedLaplacianSym", "header": "['class', 'AbstractMatrixGraphTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 194 }, { "content": " def testNormalisedLaplacianRw(self):\n numVertices = 10\n numFeatures = 0\n\n vList = VertexList(numVertices, numFeatures)\n graph = SparseGraph(vList)\n\n ell = 2\n m = 2\n generator = BarabasiAlbertGenerator(ell, m)\n graph = generator.generate(graph)\n\n k = 10\n W = graph.getSparseWeightMatrix()\n L = GraphUtils.normalisedLaplacianRw(W)\n\n L2 = graph.normalisedLaplacianRw()\n\n tol = 10**-6\n self.assertTrue(numpy.linalg.norm(L - L2) < tol)\n\n #Test zero rows/cols \n W = scipy.sparse.csr_matrix((5, 5))\n W[1, 0] = 1\n W[0, 1] = 1\n L = GraphUtils.normalisedLaplacianRw(W)\n \n for i in range(2, 5): \n self.assertEquals(L[i, i], 0)", "metadata": "root.AbstractMatrixGraphTest.testNormalisedLaplacianRw", "header": "['class', 'AbstractMatrixGraphTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 225 } ]
[ { "span": "self.assertTrue(numpy.linalg.norm(X - edges) < tol )", "start_line": 55, "start_column": 8, "end_line": 55, "end_column": 60 }, { "span": "self.assertTrue(numpy.linalg.norm(X - edges[[5,2,1], :]) < tol )", "start_line": 59, "start_column": 8, "end_line": 59, "end_column": 72 }, { "span": "self.assertTrue(numpy.linalg.norm(X[0, 0:numFeatures] - vList.getVertex(1)) < tol )", "start_line": 74, "start_column": 8, "end_line": 74, "end_column": 91 }, { "span": "self.assertTrue(numpy.linalg.norm(X[0, numFeatures:numFeatures*2] - vList.getVertex(0)) < tol )", "start_line": 75, "start_column": 8, "end_line": 75, "end_column": 103 }, { "span": "self.assertTrue(numpy.linalg.norm(X[1, 0:numFeatures] - vList.getVertex(3)) < tol )", "start_line": 76, "start_column": 8, "end_line": 76, "end_column": 91 }, { "span": "self.assertTrue(numpy.linalg.norm(X[1, numFeatures:numFeatures*2] - vList.getVertex(1)) < tol )", "start_line": 77, "start_column": 8, "end_line": 77, "end_column": 103 }, { "span": "self.assertTrue(numpy.linalg.norm(X[0, 0:numFeatures] - vList.getVertex(0)) < tol )", "start_line": 87, "start_column": 8, "end_line": 87, "end_column": 91 }, { "span": "self.assertTrue(numpy.linalg.norm(X[0, numFeatures:numFeatures*2] - vList.getVertex(1)) < tol )", "start_line": 88, "start_column": 8, "end_line": 88, "end_column": 103 }, { "span": "self.assertTrue(numpy.linalg.norm(X[1, 0:numFeatures] - vList.getVertex(1)) < tol )", "start_line": 89, "start_column": 8, "end_line": 89, "end_column": 91 }, { "span": "self.assertTrue(numpy.linalg.norm(X[1, numFeatures:numFeatures*2] - vList.getVertex(3)) < tol )", "start_line": 90, "start_column": 8, "end_line": 90, "end_column": 103 }, { "span": "self.assertTrue(numpy.linalg.norm(L - L2) < tol)", "start_line": 190, "start_column": 8, "end_line": 190, "end_column": 56 }, { "span": "self.assertTrue(numpy.linalg.norm(L + L2 - 2*numpy.eye(numVertices)) < tol)", "start_line": 213, "start_column": 8, "end_line": 213, "end_column": 83 }, { "span": "self.assertTrue(numpy.linalg.norm(L - L2) < tol)", "start_line": 244, "start_column": 8, "end_line": 244, "end_column": 56 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Abstract", "Matrix", "Graph", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Vertex", "Label", "Pairs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "Vertices_", "=_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Features_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "List_", "=_", "Vertex", "List_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "List_", "._", "set", "Vertices_", "(_", "numpy_", "._", "array_", "(_", "[_", "numpy_", "._", "arange_", "(_", "0_", ",_", "6_", ")_", "]_", ")_", "._", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "=_", "Den", "se", "Graph_", "(_", "v", "List_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "1_", ",_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "1_", ",_", "3_", ",_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "2_", ",_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "2_", ",_", "3_", ",_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "4_", ",_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "3_", ",_", "4_", ",_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tol_", "=_", "10_", "**_", "-_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edges_", "=_", "graph_", "._", "get", "All", "Edges_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "X_", "=_", "Graph", "Utils_", "._", "vertex", "Label", "Pairs_", "(_", "graph_", ",_", "edges_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "X_", "-_", "edges_", ")_", "<_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "X_", "=_", "Graph", "Utils_", "._", "vertex", "Label", "Pairs_", "(_", "graph_", ",_", "edges_", "[_", "[_", "5_", ",_", "2_", ",_", "1_", "]_", ",_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "X_", "-_", "edges_", "[_", "[_", "5_", ",_", "2_", ",_", "1_", "]_", ",_", ":_", "]_", ")_", "<_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Tr", "y", " ", "a", " ", "bigger", " ", "graph_", "\\u\\u\\uNL\\u\\u\\u_", "num", "Vertices_", "=_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Features_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "List_", "=_", "Vertex", "List_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "List_", "._", "set", "Vertices_", "(_", "numpy_", "._", "random_", "._", "randn_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "=_", "Den", "se", "Graph_", "(_", "v", "List_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "1_", ",_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "1_", ",_", "3_", ",_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "edges_", "=_", "graph_", "._", "get", "All", "Edges_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "X_", "=_", "Graph", "Utils_", "._", "vertex", "Label", "Pairs_", "(_", "graph_", ",_", "edges_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "X_", "[_", "0_", ",_", "0_", ":_", "num", "Features_", "]_", "-_", "v", "List_", "._", "get", "Vertex_", "(_", "1_", ")_", ")_", "<_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "X_", "[_", "0_", ",_", "num", "Features_", ":_", "num", "Features_", "*_", "2_", "]_", "-_", "v", "List_", "._", "get", "Vertex_", "(_", "0_", ")_", ")_", "<_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "X_", "[_", "1_", ",_", "0_", ":_", "num", "Features_", "]_", "-_", "v", "List_", "._", "get", "Vertex_", "(_", "3_", ")_", ")_", "<_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "X_", "[_", "1_", ",_", "num", "Features_", ":_", "num", "Features_", "*_", "2_", "]_", "-_", "v", "List_", "._", "get", "Vertex_", "(_", "1_", ")_", ")_", "<_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Tr", "y", " ", "direct", "ed", " ", "graphs_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "=_", "Den", "se", "Graph_", "(_", "v", "List_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "1_", ",_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "1_", ",_", "3_", ",_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "edges_", "=_", "graph_", "._", "get", "All", "Edges_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "X_", "=_", "Graph", "Utils_", "._", "vertex", "Label", "Pairs_", "(_", "graph_", ",_", "edges_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "X_", "[_", "0_", ",_", "0_", ":_", "num", "Features_", "]_", "-_", "v", "List_", "._", "get", "Vertex_", "(_", "0_", ")_", ")_", "<_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "X_", "[_", "0_", ",_", "num", "Features_", ":_", "num", "Features_", "*_", "2_", "]_", "-_", "v", "List_", "._", "get", "Vertex_", "(_", "1_", ")_", ")_", "<_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "X_", "[_", "1_", ",_", "0_", ":_", "num", "Features_", "]_", "-_", "v", "List_", "._", "get", "Vertex_", "(_", "1_", ")_", ")_", "<_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "X_", "[_", "1_", ",_", "num", "Features_", ":_", "num", "Features_", "*_", "2_", "]_", "-_", "v", "List_", "._", "get", "Vertex_", "(_", "3_", ")_", ")_", "<_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Abstract", "Matrix", "Graph", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Shi", "ft", "Lap", "lac", "ian_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "Vertices_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Features_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "v", "List_", "=_", "Vertex", "List_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "=_", "Spar", "se", "Graph_", "(_", "v", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ell_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "generator_", "=_", "Bar", "aba", "si", "Alb", "ert", "Generator_", "(_", "ell_", ",_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "=_", "generator_", "._", "generate_", "(_", "graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "W_", "=_", "graph_", "._", "get", "Spar", "se", "Weig", "ht", "Matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L_", "=_", "Graph", "Utils_", "._", "shift", "Lap", "lac", "ian_", "(_", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "L2_", "=_", "2_", "*_", "numpy_", "._", "eye_", "(_", "num", "Vertices_", ")_", "-_", "graph_", "._", "normalise", "d", "Lap", "lac", "ian", "Sym", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tol_", "=_", "10_", "**_", "-_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "L_", "-_", "L2_", ")_", "<_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Abstract", "Matrix", "Graph", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Normal", "ise", "d", "Lap", "lac", "ian", "Sym", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "Vertices_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Features_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "v", "List_", "=_", "Vertex", "List_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "=_", "Spar", "se", "Graph_", "(_", "v", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ell_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "generator_", "=_", "Bar", "aba", "si", "Alb", "ert", "Generator_", "(_", "ell_", ",_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "=_", "generator_", "._", "generate_", "(_", "graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "W_", "=_", "graph_", "._", "get", "Spar", "se", "Weig", "ht", "Matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L_", "=_", "Graph", "Utils_", "._", "shift", "Lap", "lac", "ian_", "(_", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "L2_", "=_", "graph_", "._", "normalise", "d", "Lap", "lac", "ian", "Sym", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tol_", "=_", "10_", "**_", "-_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "L_", "+_", "L2_", "-_", "2_", "*_", "numpy_", "._", "eye_", "(_", "num", "Vertices_", ")_", ")_", "<_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Test", " ", "zero", " ", "rows", "/", "cols", " _", "\\u\\u\\uNL\\u\\u\\u_", "W_", "=_", "scipy_", "._", "sparse_", "._", "csr", "\\u", "matrix_", "(_", "(_", "5_", ",_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "W_", "[_", "1_", ",_", "0_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "W_", "[_", "0_", ",_", "1_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L_", "=_", "Graph", "Utils_", "._", "normalise", "d", "Lap", "lac", "ian", "Sym", "_", "(_", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "2_", ",_", "5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "L_", "[_", "i_", ",_", "i_", "]_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Abstract", "Matrix", "Graph", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Normal", "ise", "d", "Lap", "lac", "ian", "Rw", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "Vertices_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Features_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "v", "List_", "=_", "Vertex", "List_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "=_", "Spar", "se", "Graph_", "(_", "v", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ell_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "generator_", "=_", "Bar", "aba", "si", "Alb", "ert", "Generator_", "(_", "ell_", ",_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "=_", "generator_", "._", "generate_", "(_", "graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "W_", "=_", "graph_", "._", "get", "Spar", "se", "Weig", "ht", "Matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L_", "=_", "Graph", "Utils_", "._", "normalise", "d", "Lap", "lac", "ian", "Rw", "_", "(_", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "L2_", "=_", "graph_", "._", "normalise", "d", "Lap", "lac", "ian", "Rw", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tol_", "=_", "10_", "**_", "-_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "L_", "-_", "L2_", ")_", "<_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Test", " ", "zero", " ", "rows", "/", "cols", " _", "\\u\\u\\uNL\\u\\u\\u_", "W_", "=_", "scipy_", "._", "sparse_", "._", "csr", "\\u", "matrix_", "(_", "(_", "5_", ",_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "W_", "[_", "1_", ",_", "0_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "W_", "[_", "0_", ",_", "1_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L_", "=_", "Graph", "Utils_", "._", "normalise", "d", "Lap", "lac", "ian", "Rw", "_", "(_", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "2_", ",_", "5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "L_", "[_", "i_", ",_", "i_", "]_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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ast\nimport sqlite3\nimport os\nimport stat\nimport threading\nfrom openpds.core.models import Profile\nfrom openpds.accesscontrol.models import Settings, Context\nfrom openpds import settings\nimport datetime\nimport math\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class AccessControlledInternalDataStore(object):\n\n\n\n\n\n\n\n", "metadata": "root.AccessControlledInternalDataStore", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def __init__(self, ids):\n self.ids = ids\n self.profile = ids.profile\n self.datastore_owner_id = self.profile.id\n self.app_id = ids.app_id\n self.lab_id = ids.lab_id\n self.mapping = {'ActivityProbe': 'activity_probe', 'SmsProbe': 'sms_probe', 'CallLogProbe': 'call_log_probe', 'BluetoothProbe':'bluetooth_probe', 'WifiProbe': 'wifi_probe', 'LocationProbe': 'simple_location_probe', 'ScreenProbe': 'screen_probe', 'RunningApplicationsProbe': 'running_applications_probe', 'HardwareInfoProbe': 'hardware_info_probe', 'AppUsageProbe': 'app_usage_probe'} ", "metadata": "root.AccessControlledInternalDataStore.__init__", "header": "['class', 'AccessControlledInternalDataStore', '(', 'object', ')', ':', '___EOS___']", "index": 12 }, { "content": " def saveAnswer(self, key, data):\n return self.ids.saveAnswer(key, data)", "metadata": "root.AccessControlledInternalDataStore.saveAnswer", "header": "['class', 'AccessControlledInternalDataStore', '(', 'object', ')', ':', '___EOS___']", "index": 20 }, { "content": " def getAnswer(self, key):\n return self.ids.getAnswer(key)", "metadata": "root.AccessControlledInternalDataStore.getAnswer", "header": "['class', 'AccessControlledInternalDataStore', '(', 'object', ')', ':', '___EOS___']", "index": 23 }, { "content": " def getAnswerList(self, key):\n return self.ids.getAnswerList(key)", "metadata": "root.AccessControlledInternalDataStore.getAnswerList", "header": "['class', 'AccessControlledInternalDataStore', '(', 'object', ')', ':', '___EOS___']", "index": 26 }, { "content": " def saveData(self, data, collectionname):\n return self.ids.saveData(data, collectionname)", "metadata": "root.AccessControlledInternalDataStore.saveData", "header": "['class', 'AccessControlledInternalDataStore', '(', 'object', ')', ':', '___EOS___']", "index": 29 }, { "content": " def testServiceEnabled(self):\n result = False\n settingsObjects = Settings.objects.filter(datastore_owner_id=self.datastore_owner_id, app_id=self.app_id, lab_id=self.lab_id, service_id=self.service_id)\n # NOTE: The below is a hack to assure that things still function for those on a field trial where opt-in is implied (thus don't have settings entries)\n if len(settingsObjects) == 0:\n result = True\n return result", "metadata": "root.AccessControlledInternalDataStore.testServiceEnabled", "header": "['class', 'AccessControlledInternalDataStore', '(', 'object', ')', ':', '___EOS___']", "index": 32 }, { "content": " def getData(self, probe, startTime, endTime):\n dataLocations = None\n if probe == \"LocationProbe\":\n dataLocations = set()\n cursor = self.ids.getData(probe, startTime, endTime)\n if cursor:\n for entry in cursor:\n dataLocations.add((entry[u'value'][u'mlatitude'], entry[u'value'][u'mlongitude']))\n\n column = self.mapping[probe]\n probe_flag = False\n try:\n settingsObject = Settings.objects.get(datastore_owner_id=self.datastore_owner_id, app_id=self.app_id, lab_id=self.lab_id)\n try:\n contextObject = Context.objects.get(pk=settingsObject.context_label_id)\n except Context.DoesNotExist:\n contextObject = None\n except Settings.DoesNotExist:\n settingsObject = None\n contextObject = None\n\n # NOTE: Hack for those who don't have settings entries (field trial users). This will go away in the long term\n if settingsObject is None:\n probe_flag = True\n validTimes = True\n validLocations = True\n else:\n probe_flag = settingsObject.__dict__[column]\n if startTime is None or endTime is None:\n validTimes = False\n validLocations = False\n else:\n validTimes = self.checkTime(startTime, endTime, contextObject)\n #print \"validTimes; %s\"%validTimes\n validLocations = self.checkLocation(startTime, endTime, contextObject, dataLocations)\n \n if probe_flag and validTimes and validLocations:\n return self.ids.getData(probe, startTime, endTime)\n else:\n #print probe_flag, validTimes, validLocations\n return None", "metadata": "root.AccessControlledInternalDataStore.getData", "header": "['class', 'AccessControlledInternalDataStore', '(', 'object', ')', ':', '___EOS___']", "index": 40 }, { "content": " def checkTime(self, startTime, endTime, context):\n\n timestamp_start = datetime.datetime.fromtimestamp(startTime)\n #print timestamp_start.strftime('%Y-%m-%d %H:%M')\n start_hour = int(timestamp_start.strftime('%H'))\n start_minute = int(timestamp_start.strftime('%M'))\n start_time = datetime.datetime.now().replace(hour=start_hour, minute=start_minute, second=0, microsecond=0)\n start_day = timestamp_start.weekday()\n timestamp_end = datetime.datetime.fromtimestamp(endTime)\n end_hour = int(timestamp_end.strftime('%H'))\n end_minute = int(timestamp_end.strftime('%M'))\n end_time = datetime.datetime.now().replace(hour=end_hour, minute=end_minute, second=0, microsecond=0)\n end_day = timestamp_end.weekday()\n\n timeFlag = False\n dayFlag = True\n\n context_start = [int(start.strip()) for start in context.context_duration_start.split(':')]\n context_start_hour = context_start[0]\n context_start_minute = context_start[1]\n context_start_time = datetime.datetime.now().replace(hour=context_start_hour, minute=context_start_minute, second=0, microsecond=0)\n\n context_end = [int(end.strip()) for end in context.context_duration_end.split(':')]\n context_end_hour = context_end[0]\n context_end_minute = context_end[1]\n context_end_time = datetime.datetime.now().replace(hour=context_end_hour, minute=context_end_minute, second=0, microsecond=0)\n\n\n if context_start_time <= start_time and end_time <= context_end_time:\n timeFlag = True\n\n #Python datetime: Monday = 0, Sunday = 6\n #Client code will be fixed to reflect this day ordering\n context_days = context.context_duration_days\n context_days_list = [int(x) for x in context_days[1:-1].split(',')]\n if start_day < end_day:\n start_day_temp = start_day\n while start_day_temp <= end_day:\n if context_days_list[start_day_temp] != 1:\n dayFlag = False\n break\n start_day_temp += 1\n elif start_day > end_day:\n start_day_temp = start_day\n while start_day_temp <= 6:\n if context_days_list[start_day_temp] != 1:\n dayFlag = False\n break\n start_day_temp += 1\n end_day_temp = 0\n while end_day_temp <= end_day:\n if context_days_list[end_day_temp] != 1:\n dayFlag = False\n break\n end_day_temp += 1\n else:\n if context_days_list[start_day] != 1:\n dayFlag = False\n #print \"dayFlag, timeFlag: %s, %s\"%(dayFlag, timeFlag)\n return dayFlag and timeFlag", "metadata": "root.AccessControlledInternalDataStore.checkTime", "header": "['class', 'AccessControlledInternalDataStore', '(', 'object', ')', ':', '___EOS___']", "index": 82 }, { "content": " def checkLocation(self, startTime, endTime, context, dataLocations):\n if dataLocations is None:\n dataLocations = set()\n cursor = self.ids.getData(\"LocationProbe\", startTime, endTime)\n if cursor:\n for entry in cursor:\n dataLocations.add((entry[u'value'][u'mlatitude'], entry[u'value'][u'mlongitude']))\n\n contextLocations = set()\n temp_places = [x.strip() for x in context.context_places[1:-1].split(\"lat/lng:\") if x] \n\n #No location specified in the context, alright to use the data.\n if len(temp_places) == 0:\n return True\n\n contextLocations = []\n for place in temp_places:\n if '),' in place:\n placeValues = [float(x.strip()) for x in place[:-1][1:-1].split(',')]\n else:\n placeValues = [float(x.strip()) for x in place[1:-1].split(',')]\n contextLocations.append((placeValues[0], placeValues[1]))\n \n dataLocationsChecks = [0] * len(dataLocations)\n dataLocationsIndex = 0\n\n #Haversine distance computation.\n #Source: http://rosettacode.org/wiki/Haversine_formula#Python\n R = 6372.8 # Earth radius in kilometers\n for dataLocation in dataLocations:\n for contextLocation in contextLocations:\n dLat = math.radians(dataLocation[0] - contextLocation[0])\n dLon = math.radians(dataLocation[1] - contextLocation[1])\n lat1 = math.radians(contextLocation[0])\n lat2 = math.radians(dataLocation[0])\n \n a = math.sin(dLat/2)**2 + math.cos(lat1)*math.cos(lat2)*math.sin(dLon/2)**2\n c = 2*math.asin(math.sqrt(a))\n\n distance = R * c * 1000\n if distance < 500:\n dataLocationsChecks[dataLocationsIndex] = 1\n break\n dataLocationsIndex += 1\n\n if all(check == 1 for check in dataLocationsChecks):\n return True \n else:\n return False", "metadata": "root.AccessControlledInternalDataStore.checkLocation", "header": "['class', 'AccessControlledInternalDataStore', '(', 'object', ')', ':', '___EOS___']", "index": 143 }, { "content": "def getAccessControlledInternalDataStore(ids):\n try:\n internalDataStore = AccessControlledInternalDataStore(ids)\n except Exception as e:\n internalDataStore = None\n print str(e)\n return internalDataStore", "metadata": "root.getAccessControlledInternalDataStore", "header": "['module', '___EOS___']", "index": 194 } ]
[ { "span": "import ast", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 10 }, { "span": "import sqlite3", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 14 }, { "span": "import os", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 9 }, { "span": "import stat", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 11 }, { "span": "import threading", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 16 }, { "span": "from openpds.core.models import Profile", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 39 }, { "span": "from openpds import settings", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "ast_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sqlite3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "stat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openp", "ds_", "._", "core_", "._", "models_", "import_", "Profile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openp", "ds_", "._", "access", "control_", "._", "models_", "import_", "Settings_", ",_", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openp", "ds_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Access", "Controlle", "d", "Intern", "al", "Data", "Store_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Access", "Controlle", "d", "Intern", "al", "Data", "Store_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "ids_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ids_", "=_", "ids_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "profile_", "=_", "ids_", "._", "profile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "datast", "ore", "\\u", "owner", "\\u", "id_", "=_", "self_", "._", "profile_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app", "\\u", "id_", "=_", "ids_", "._", "app", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lab", "\\u", "id_", "=_", "ids_", "._", "lab", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mapping_", "=_", "{_", "'", "Activ", "it", "y", "Probe", "'_", ":_", "'", "activit", "y", "\\u", "prob", "e", "'_", ",_", "'", "Sm", "s", "Probe", "'_", ":_", "'", "sms", "\\u", "prob", "e", "'_", ",_", "'", "Call", "Log", "Probe", "'_", ":_", "'", "call", "\\u", "log", "\\u", "prob", "e", "'_", ",_", "'", "Bluetooth", "Probe", "'_", ":_", "'", "bluetooth", "\\u", "prob", "e", "'_", ",_", "'", "Wi", "fi", "Probe", "'_", ":_", "'", "wifi", "\\u", "prob", "e", "'_", ",_", "'", "Locat", "ion", "Probe", "'_", ":_", "'", "simple", "\\u", "location", "\\u", "prob", "e", "'_", ",_", "'", "Scr", "een", "Probe", "'_", ":_", "'", "screen", "\\u", "prob", "e", "'_", ",_", "'", "Run", "ning", "Applica", "tion", "s", "Probe", "'_", ":_", "'", "runn", "ing", "\\u", "applica", "tion", "s", "\\u", "prob", "e", "'_", ",_", "'", "Hard", "ware", "Info", "Probe", "'_", ":_", "'", "hard", "ware", "\\u", "info", "\\u", "prob", "e", "'_", ",_", "'", "App", "Us", "age", "Probe", "'_", ":_", "'", "app", "\\u", "usage", "\\u", "prob", "e", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Access", "Controlle", "d", "Intern", "al", "Data", "Store_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "Answer_", "(_", "self_", ",_", "key_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "ids_", "._", "save", "Answer_", "(_", "key_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Access", "Controlle", "d", "Intern", "al", "Data", "Store_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Answer_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "ids_", "._", "get", "Answer_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Access", "Controlle", "d", "Intern", "al", "Data", "Store_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Answer", "List_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "ids_", "._", "get", "Answer", "List_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Access", "Controlle", "d", "Intern", "al", "Data", "Store_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "Data_", "(_", "self_", ",_", "data_", ",_", "collection", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "ids_", "._", "save", "Data_", "(_", "data_", ",_", "collection", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Access", "Controlle", "d", "Intern", "al", "Data", "Store_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Service", "Enabled_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings", "Objects_", "=_", "Settings_", "._", "objects_", "._", "filter_", "(_", "datast", "ore", "\\u", "owner", "\\u", "id_", "=_", "self_", "._", "datast", "ore", "\\u", "owner", "\\u", "id_", ",_", "app", "\\u", "id_", "=_", "self_", "._", "app", "\\u", "id_", ",_", "lab", "\\u", "id_", "=_", "self_", "._", "lab", "\\u", "id_", ",_", "service", "\\u", "id_", "=_", "self_", "._", "service", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "The", " ", "belo", "w", " ", "is", " ", "a", " ", "hack", " ", "to", " ", "ass", "ure", " ", "tha", "t", " ", "thing", "s", " ", "still", " ", "function", " ", "for", " ", "tho", "se", " ", "on", " ", "a", " ", "field", " ", "tria", "l", " ", "where", " ", "opt", "-", "in", " ", "is", " ", "impli", "ed", " ", "(", "thu", "s", " ", "don", "'", "t", " ", "have", " ", "settings", " ", "entri", "es", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "settings", "Objects_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Access", "Controlle", "d", "Intern", "al", "Data", "Store_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Data_", "(_", "self_", ",_", "probe_", ",_", "start", "Time_", ",_", "end", "Time_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data", "Locations_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "probe_", "==_", "\"", "Locat", "ion", "Probe", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data", "Locations_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "=_", "self_", "._", "ids_", "._", "get", "Data_", "(_", "probe_", ",_", "start", "Time_", ",_", "end", "Time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cursor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "entry_", "in_", "cursor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data", "Locations_", "._", "add_", "(_", "(_", "entry_", "[_", "u", "'", "value", "'_", "]_", "[_", "u", "'", "mla", "titu", "de", "'_", "]_", ",_", "entry_", "[_", "u", "'", "value", "'_", "]_", "[_", "u", "'", "mlo", "ngi", "tude", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "column_", "=_", "self_", "._", "mapping_", "[_", "probe_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prob", "e\\u", "flag_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "settings", "Object_", "=_", "Settings_", "._", "objects_", "._", "get_", "(_", "datast", "ore", "\\u", "owner", "\\u", "id_", "=_", "self_", "._", "datast", "ore", "\\u", "owner", "\\u", "id_", ",_", "app", "\\u", "id_", "=_", "self_", "._", "app", "\\u", "id_", ",_", "lab", "\\u", "id_", "=_", "self_", "._", "lab", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context", "Object_", "=_", "Context_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "settings", "Object_", "._", "context", "\\u", "label", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Context_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context", "Object_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Settings_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "settings", "Object_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context", "Object_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "Hack", " ", "for", " ", "tho", "se", " ", "who", " ", "don", "'", "t", " ", "have", " ", "settings", " ", "entri", "es", " ", "(", "field", " ", "tria", "l", " ", "users", ").", " ", "Thi", "s", " ", "will", " ", "go", " ", "awa", "y", " ", "in", " ", "the", " ", "long", " ", "term_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "settings", "Object_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prob", "e\\u", "flag_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid", "Times_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid", "Locations_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prob", "e\\u", "flag_", "=_", "settings", "Object_", "._", "\\u\\u", "dict\\u\\u_", "[_", "column_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "start", "Time_", "is_", "None_", "or_", "end", "Time_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "valid", "Times_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid", "Locations_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "valid", "Times_", "=_", "self_", "._", "check", "Time_", "(_", "start", "Time_", ",_", "end", "Time_", ",_", "context", "Object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "valid", "Times", ";", " ", "%", "s", "\"%", "valid", "Times_", "\\u\\u\\uNL\\u\\u\\u_", "valid", "Locations_", "=_", "self_", "._", "check", "Location_", "(_", "start", "Time_", ",_", "end", "Time_", ",_", "context", "Object_", ",_", "data", "Locations_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "prob", "e\\u", "flag_", "and_", "valid", "Times_", "and_", "valid", "Locations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "ids_", "._", "get", "Data_", "(_", "probe_", ",_", "start", "Time_", ",_", "end", "Time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "prob", "e\\u", "flag", ",", " ", "valid", "Times", ",", " ", "valid", "Locations_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Access", "Controlle", "d", "Intern", "al", "Data", "Store_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Time_", "(_", "self_", ",_", "start", "Time_", ",_", "end", "Time_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timestamp", "\\u", "start_", "=_", "datetime_", "._", "datetime_", "._", "fromtimestamp_", "(_", "start", "Time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "timestamp", "\\u", "start", ".", "strf", "time", "('", "%", "Y", "-%", "m", "-%", "d", " ", "%", "H", ":", "%", "M", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "hour_", "=_", "int_", "(_", "timestamp", "\\u", "start_", "._", "strftime_", "(_", "'%", "H", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "minute_", "=_", "int_", "(_", "timestamp", "\\u", "start_", "._", "strftime_", "(_", "'%", "M", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "time_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "._", "replace_", "(_", "hour_", "=_", "start", "\\u", "hour_", ",_", "minute_", "=_", "start", "\\u", "minute_", ",_", "second_", "=_", "0_", ",_", "microsecond_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "day_", "=_", "timestamp", "\\u", "start_", "._", "weekday_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timestamp", "\\u", "end_", "=_", "datetime_", "._", "datetime_", "._", "fromtimestamp_", "(_", "end", "Time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "hour_", "=_", "int_", "(_", "timestamp", "\\u", "end_", "._", "strftime_", "(_", "'%", "H", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "minute_", "=_", "int_", "(_", "timestamp", "\\u", "end_", "._", "strftime_", "(_", "'%", "M", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "time_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "._", "replace_", "(_", "hour_", "=_", "end", "\\u", "hour_", ",_", "minute_", "=_", "end", "\\u", "minute_", ",_", "second_", "=_", "0_", ",_", "microsecond_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "day_", "=_", "timestamp", "\\u", "end_", "._", "weekday_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "time", "Flag_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "day", "Flag_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "context", "\\u", "start_", "=_", "[_", "int_", "(_", "start_", "._", "strip_", "(_", ")_", ")_", "for_", "start_", "in_", "context_", "._", "context", "\\u", "duration", "\\u", "start_", "._", "split_", "(_", "':'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context", "\\u", "start", "\\u", "hour_", "=_", "context", "\\u", "start_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context", "\\u", "start", "\\u", "minute_", "=_", "context", "\\u", "start_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context", "\\u", "start", "\\u", "time_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "._", "replace_", "(_", "hour_", "=_", "context", "\\u", "start", "\\u", "hour_", ",_", "minute_", "=_", "context", "\\u", "start", "\\u", "minute_", ",_", "second_", "=_", "0_", ",_", "microsecond_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "context", "\\u", "end_", "=_", "[_", "int_", "(_", "end_", "._", "strip_", "(_", ")_", ")_", "for_", "end_", "in_", "context_", "._", "context", "\\u", "duration", "\\u", "end_", "._", "split_", "(_", "':'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context", "\\u", "end", "\\u", "hour_", "=_", "context", "\\u", "end_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context", "\\u", "end", "\\u", "minute_", "=_", "context", "\\u", "end_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context", "\\u", "end", "\\u", "time_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "._", "replace_", "(_", "hour_", "=_", "context", "\\u", "end", "\\u", "hour_", ",_", "minute_", "=_", "context", "\\u", "end", "\\u", "minute_", ",_", "second_", "=_", "0_", ",_", "microsecond_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "context", "\\u", "start", "\\u", "time_", "<=_", "start", "\\u", "time_", "and_", "end", "\\u", "time_", "<=_", "context", "\\u", "end", "\\u", "time_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time", "Flag_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Pyth", "on", " ", "datetime", ":", " ", "Mon", "day", " ", "=", " ", "0", ",", " ", "Sun", "day", " ", "=", " ", "6_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Client", " ", "code", " ", "will", " ", "be", " ", "fixed", " ", "to", " ", "reflect", " ", "this", " ", "day", " ", "ordering_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context", "\\u", "days_", "=_", "context_", "._", "context", "\\u", "duration", "\\u", "days_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context", "\\u", "day", "s", "\\u", "list_", "=_", "[_", "int_", "(_", "x_", ")_", "for_", "x_", "in_", "context", "\\u", "days_", "[_", "1_", ":_", "-_", "1_", "]_", "._", "split_", "(_", "','_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "start", "\\u", "day_", "<_", "end", "\\u", "day_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "day", "\\u", "temp_", "=_", "start", "\\u", "day_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "start", "\\u", "day", "\\u", "temp_", "<=_", "end", "\\u", "day_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "context", "\\u", "day", "s", "\\u", "list_", "[_", "start", "\\u", "day", "\\u", "temp_", "]_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "day", "Flag_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "start", "\\u", "day", "\\u", "temp_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "start", "\\u", "day_", ">_", "end", "\\u", "day_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "day", "\\u", "temp_", "=_", "start", "\\u", "day_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "start", "\\u", "day", "\\u", "temp_", "<=_", "6_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "context", "\\u", "day", "s", "\\u", "list_", "[_", "start", "\\u", "day", "\\u", "temp_", "]_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "day", "Flag_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "start", "\\u", "day", "\\u", "temp_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "end", "\\u", "day", "\\u", "temp_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "end", "\\u", "day", "\\u", "temp_", "<=_", "end", "\\u", "day_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "context", "\\u", "day", "s", "\\u", "list_", "[_", "end", "\\u", "day", "\\u", "temp_", "]_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "day", "Flag_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "end", "\\u", "day", "\\u", "temp_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "context", "\\u", "day", "s", "\\u", "list_", "[_", "start", "\\u", "day_", "]_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "day", "Flag_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "day", "Fla", "g", ",", " ", "time", "Fla", "g", ":", " ", "%", "s", ",", " ", "%", "s", "\"%", "(", "day", "Fla", "g", ",", " ", "time", "Fla", "g", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "day", "Flag_", "and_", "time", "Flag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Access", "Controlle", "d", "Intern", "al", "Data", "Store_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Location_", "(_", "self_", ",_", "start", "Time_", ",_", "end", "Time_", ",_", "context_", ",_", "data", "Locations_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "data", "Locations_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data", "Locations_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "=_", "self_", "._", "ids_", "._", "get", "Data_", "(_", "\"", "Locat", "ion", "Probe", "\"_", ",_", "start", "Time_", ",_", "end", "Time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cursor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "entry_", "in_", "cursor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data", "Locations_", "._", "add_", "(_", "(_", "entry_", "[_", "u", "'", "value", "'_", "]_", "[_", "u", "'", "mla", "titu", "de", "'_", "]_", ",_", "entry_", "[_", "u", "'", "value", "'_", "]_", "[_", "u", "'", "mlo", "ngi", "tude", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context", "Locations_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "places_", "=_", "[_", "x_", "._", "strip_", "(_", ")_", "for_", "x_", "in_", "context_", "._", "context", "\\u", "places_", "[_", "1_", ":_", "-_", "1_", "]_", "._", "split_", "(_", "\"", "lat", "/", "ln", "g", ":\"_", ")_", "if_", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "No", " ", "location", " ", "specified", " ", "in", " ", "the", " ", "context", ",", " ", "alr", "ight", " ", "to", " ", "use", " ", "the", " ", "data", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "temp", "\\u", "places_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context", "Locations_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "place_", "in_", "temp", "\\u", "places_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "')", ",'_", "in_", "place_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "place", "Values_", "=_", "[_", "float_", "(_", "x_", "._", "strip_", "(_", ")_", ")_", "for_", "x_", "in_", "place_", "[_", ":_", "-_", "1_", "]_", "[_", "1_", ":_", "-_", "1_", "]_", "._", "split_", "(_", "','_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "place", "Values_", "=_", "[_", "float_", "(_", "x_", "._", "strip_", "(_", ")_", ")_", "for_", "x_", "in_", "place_", "[_", "1_", ":_", "-_", "1_", "]_", "._", "split_", "(_", "','_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context", "Locations_", "._", "append_", "(_", "(_", "place", "Values_", "[_", "0_", "]_", ",_", "place", "Values_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data", "Locat", "ion", "s", "Check", "s_", "=_", "[_", "0_", "]_", "*_", "len_", "(_", "data", "Locations_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "Locat", "ion", "s", "Index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Ha", "versi", "ne", " ", "distance", " ", "computation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "Sou", "rce", ":", " ", "http", "://", "rose", "tta", "code", ".", "org", "/", "wiki", "/", "Ha", "versi", "ne", "\\u", "formula", "#", "Python_", "\\u\\u\\uNL\\u\\u\\u_", "R_", "=_", "637", "2.8", "_", "#", " ", "Ear", "th", " ", "radi", "us", " ", "in", " ", "kilo", "meters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "data", "Location_", "in_", "data", "Locations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "context", "Location_", "in_", "context", "Locations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d", "Lat_", "=_", "math_", "._", "radians_", "(_", "data", "Location_", "[_", "0_", "]_", "-_", "context", "Location_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d", "Lon", "_", "=_", "math_", "._", "radians_", "(_", "data", "Location_", "[_", "1_", "]_", "-_", "context", "Location_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lat1_", "=_", "math_", "._", "radians_", "(_", "context", "Location_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lat2_", "=_", "math_", "._", "radians_", "(_", "data", "Location_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "math_", "._", "sin_", "(_", "d", "Lat_", "/_", "2_", ")_", "**_", "2_", "+_", "math_", "._", "cos_", "(_", "lat1_", ")_", "*_", "math_", "._", "cos_", "(_", "lat2_", ")_", "*_", "math_", "._", "sin_", "(_", "d", "Lon", "_", "/_", "2_", ")_", "**_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "2_", "*_", "math_", "._", "asin", "_", "(_", "math_", "._", "sqrt_", "(_", "a_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "distance_", "=_", "R_", "*_", "c_", "*_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "distance_", "<_", "500_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data", "Locat", "ion", "s", "Check", "s_", "[_", "data", "Locat", "ion", "s", "Index_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data", "Locat", "ion", "s", "Index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "all_", "(_", "check_", "==_", "1_", "for_", "check_", "in_", "data", "Locat", "ion", "s", "Check", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Access", "Controlle", "d", "Intern", "al", "Data", "Store_", "(_", "ids_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "internal", "Data", "Store_", "=_", "Access", "Controlle", "d", "Intern", "al", "Data", "Store_", "(_", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Module is imported more than once
gutomaia/pyNES/pynes/tests/image_test.py
[ { "content": "# -*- coding: utf-8 -*-\nimport os\n\nfrom PIL import Image\nfrom pynes import image, sprite\nfrom pynes.tests import SpriteTestCase\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def test_convert_to_nametable_pythonbrasil2(self):\n return\n nt, sprs = image.convert_to_nametable('fixtures/pythonbrasil8.png')\n image.export_chr('sprite.chr', 'pythonbrasil8.png')\n image.export_nametable(\n 'nametable.bin', 'sprite.chr', 'pythonbrasil8.png')\n import os\n os.rename('nametable.bin', 'pythonbrasil8.bin')\n image.export_nametable(\n 'fixtures/nerdynights/scrolling/garoa.bin',\n 'fixtures/nerdynights/scrolling/sprite.chr',\n 'garoa.png')", "metadata": "root.ImageTest.test_convert_to_nametable_pythonbrasil2", "header": "['class', 'ImageTest', '(', 'SpriteTestCase', ')', ':', '___EOS___']", "index": 186 } ]
[ { "span": "import os", "start_line": 192, "start_column": 8, "end_line": 192, "end_column": 17 } ]
[ { "span": "import os", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 9 } ]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "more_", "than_", "once_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "PIL_", "import_", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyn", "es_", "import_", "image_", ",_", "sprite_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyn", "es_", "._", "tests_", "import_", "Spr", "ite", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "class_", "Image", "Test_", "(_", "Spr", "ite", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "convert", "\\u", "to", "\\u", "name", "table", "\\u", "python", "bra", "sil", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nt_", ",_", "spr", "s_", "=_", "image_", "._", "convert", "\\u", "to", "\\u", "name", "table_", "(_", "'", "fixture", "s", "/", "python", "bra", "sil", "8", ".", "png", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "._", "export", "\\u", "chr_", "(_", "'", "spri", "te", ".", "chr", "'_", ",_", "'", "python", "bra", "sil", "8", ".", "png", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "._", "export", "\\u", "name", "table_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "table", ".", "bin", "'_", ",_", "'", "spri", "te", ".", "chr", "'_", ",_", "'", "python", "bra", "sil", "8", ".", "png", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "rename_", "(_", "'", "name", "table", ".", "bin", "'_", ",_", "'", "python", "bra", "sil", "8", ".", "bin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "._", "export", "\\u", "name", "table_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fixture", "s", "/", "ner", "dyn", "ight", "s", "/", "scrolling", "/", "gar", "oa", ".", "bin", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fixture", "s", "/", "ner", "dyn", "ight", "s", "/", "scrolling", "/", "spri", "te", ".", "chr", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gar", "oa", ".", "png", "'_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
karesansui/karesansui/karesansui/lib/const.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# This file is part of Karesansui Core.\n#\n# Copyright (C) 2009-2012 HDE, Inc.\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# THE SOFTWARE.\n#\n\nimport os\nimport math\nimport karesansui\n\nDEFAULT_LANGS = {\n \"ja_JP\": {'DATE_FORMAT' : (\"%Y/%m/%d\", \"%Y/%m/%d %H:%M:%S\", \"yy-mm-dd\")},\n \"en_US\": {'DATE_FORMAT' : (\"%m/%d/%Y\", \"%m/%d/%Y %H:%M:%S\", \"mm-dd-yy\")},\n# \"de_DE\": {'DATE_FORMAT' : (\"%m/%d/%Y\", \"%m/%d/%Y %H:%M:%S\", \"mm-dd-yy\")},\n# \"es_ES\": {'DATE_FORMAT' : (\"%m/%d/%Y\", \"%m/%d/%Y %H:%M:%S\", \"mm-dd-yy\")},\n# \"fr_FR\": {'DATE_FORMAT' : (\"%m/%d/%Y\", \"%m/%d/%Y %H:%M:%S\", \"mm-dd-yy\")},\n# \"it_IT\": {'DATE_FORMAT' : (\"%m/%d/%Y\", \"%m/%d/%Y %H:%M:%S\", \"mm-dd-yy\")},\n# \"ko_KR\": {'DATE_FORMAT' : (\"%m/%d/%Y\", \"%m/%d/%Y %H:%M:%S\", \"mm-dd-yy\")},\n# \"pt_BR\": {'DATE_FORMAT' : (\"%m/%d/%Y\", \"%m/%d/%Y %H:%M:%S\", \"mm-dd-yy\")},\n# \"ru_RU\": {'DATE_FORMAT' : (\"%m/%d/%Y\", \"%m/%d/%Y %H:%M:%S\", \"mm-dd-yy\")},\n# \"zh_CN\": {'DATE_FORMAT' : (\"%m/%d/%Y\", \"%m/%d/%Y %H:%M:%S\", \"mm-dd-yy\")},\n}\n\nDEFAULT_DATE_FORMAT = (\"%m/%d/%Y\", \"%m/%d/%Y %H:%M:%S\", \"mm/dd/yy\", \"%Y/%m/%d %H:%M\")\n\n# define karesansui paths & users\nKARESANSUI_USER = \"kss\"\nKARESANSUI_GROUP = \"kss\"\nKARESANSUI_PREFIX = \"/var/lib/karesansui\"\nKARESANSUI_TMP_DIR = KARESANSUI_PREFIX + \"/tmp\"\nKARESANSUI_SYSCONF_DIR = \"/etc/karesansui\"\nKARESANSUI_DATA_DIR = \"/var/lib/karesansui\"\n\nMACHINE_ATTRIBUTE = {'HOST':0,\n 'GUEST':1,\n 'URI':2,\n }\nMACHINE_HYPERVISOR = {'REAL':0,\n 'XEN':1,\n 'KVM':2,\n 'URI':3,\n }\n\n# define vendor paths\nVENDOR_PREFIX = \"/usr\"\nVENDOR_BIN_DIR = VENDOR_PREFIX + \"/bin\"\nVENDOR_SBIN_DIR = VENDOR_PREFIX + \"/sbin\"\nVENDOR_SYSCONF_DIR = \"/etc\"\nVENDOR_DATA_DIR = \"/var/lib\"\nVENDOR_DATA_ISCSI_DIR = \"/var/lib/iscsi\"\nVENDOR_DATA_ISCSI_MOUNT_DIR = VENDOR_DATA_ISCSI_DIR + \"/mount\"\nVENDOR_DATA_ISCSI_DOMAINS_DIR = VENDOR_DATA_ISCSI_DIR + \"/domains\"\nVENDOR_DATA_BONDING_EVACUATION_DIR = \"/var/lib/karesansui/ifcfg\"\nVENDOR_LIBVIRT_RUN_DIR = \"/var/run/libvirt\"\nXEN_SYSCONF_DIR = \"/etc/xen\"\n\n#LOGOUT_FILE_PREFIX = \"%s/logout.\" % karesansui.config['application.tmp.dir']\nLOGOUT_FILE_PREFIX = KARESANSUI_TMP_DIR + \"/logout.\"\nICON_DIR_TPL = \"%s/static/icon/%s\"\nMSG_LIMIT = 5\nTAG_CLIPPING_RANGE = 12\nMACHINE_NAME_CLIPPING_RANGE = 20\n\nDEFAULT_LIST_RANGE = 10\nJOB_LIST_RANGE = DEFAULT_LIST_RANGE\nUSER_LIST_RANGE = DEFAULT_LIST_RANGE\nTAG_LIST_RANGE = DEFAULT_LIST_RANGE\nWATCH_LIST_RANGE = DEFAULT_LIST_RANGE\nMAILTEMPLATE_LIST_RANGE = DEFAULT_LIST_RANGE\n\n# use for virt library\nVIRT_LIBVIRT_DATA_DIR = \"/var/lib/libvirt\"\nVIRT_XENDOMAINS_AUTO_DIR = XEN_SYSCONF_DIR + \"/auto\"\n\nVIRT_LIBVIRT_SOCKET_RW = VENDOR_LIBVIRT_RUN_DIR + \"/libvirt-sock\";\nVIRT_LIBVIRT_SOCKET_RO = VENDOR_LIBVIRT_RUN_DIR + \"/libvirt-sock-ro\";\n\n# kvm\nKVM_VIRTUAL_DISK_PREFIX = \"hd\"\nKVM_VIRT_CONFIG_DIR = \"/etc/karesansui/virt/kvm\"\n#KVM_VIRT_URI_RW = \"qemu+tls://127.0.0.1:16514/system?no_verify=1\"\n#KVM_VIRT_URI_RO = \"qemu+tls://127.0.0.1:16514/system?no_verify=1\"\nKVM_VIRT_URI_RW = \"qemu+tcp://127.0.0.1:16509/system\"\nKVM_VIRT_URI_RO = \"qemu+tcp://127.0.0.1:16509/system\"\nKVM_KARESANSUI_TMP_DIR = KARESANSUI_TMP_DIR + \"/kvm\"\nif os.path.exists('/usr/share/qemu-kvm/keymaps'):\n KVM_KEYMAP_DIR = '/usr/share/qemu-kvm/keymaps'\nelse:\n KVM_KEYMAP_DIR = '/usr/share/kvm/keymaps'\n#KVM_BRIDGE_PREFIX = \"(eth|bondbr)\"\nKVM_BRIDGE_PREFIX = \"br\"\n\n# xen\nXEN_VIRTUAL_DISK_PREFIX = \"xvd\"\nXEN_VIRT_CONFIG_DIR = \"/etc/karesansui/virt/xen\"\nXEN_VIRT_URI_RW = \"xen:///?socket=\" + VIRT_LIBVIRT_SOCKET_RW\nXEN_VIRT_URI_RO = \"xen:///?socket=\" + VIRT_LIBVIRT_SOCKET_RO\nXEN_KARESANSUI_TMP_DIR = KARESANSUI_TMP_DIR + \"/xen\"\nXEN_KEYMAP_DIR = '/usr/share/xen/qemu/keymaps'\n\nVIRT_XML_CONFIG_DIR = VENDOR_SYSCONF_DIR + \"/libvirt/qemu\"\n\nVIRT_SYSCONF_DIR = VENDOR_SYSCONF_DIR + \"/libvirt\"\nOLD_VIRT_DISK_DIR = VIRT_LIBVIRT_DATA_DIR + \"/disk\"\nOLD_VIRT_DISK_IMAGE_DIR = VIRT_LIBVIRT_DATA_DIR + \"/images\"\nOLD_VIRT_BOOT_IMAGE_DIR = VIRT_LIBVIRT_DATA_DIR + \"/boot\"\nOLD_VIRT_SNAPSHOT_DIR = VIRT_LIBVIRT_DATA_DIR + \"/snapshot\"\nVIRT_DOMAINS_DIR = VIRT_LIBVIRT_DATA_DIR + \"/domains\"\nVIRT_QEMU_DIR = VIRT_LIBVIRT_DATA_DIR + \"/qemu\"\nVIRT_SNAPSHOT_DIR = VIRT_QEMU_DIR + \"/snapshot\"\nVIRT_NETWORK_CONFIG_DIR = VIRT_SYSCONF_DIR + \"/qemu/networks\"\nVIRT_AUTOSTART_CONFIG_DIR = VIRT_SYSCONF_DIR + \"/qemu/autostart\"\nVIRT_LIBVIRTD_CONFIG_FILE = VIRT_SYSCONF_DIR + \"/libvirtd.conf\"\nVIRT_STORAGE_CONFIG_DIR = VIRT_SYSCONF_DIR + \"/storage\"\nVIRT_STORAGE_AUTOSTART_CONFIG_DIR = VIRT_SYSCONF_DIR + \"/storage/autostart\"\n\n# virt command\nVIRT_COMMAND_APPLY_SNAPSHOT = \"apply_snapshot.py\"\nVIRT_COMMAND_CREATE_GUEST = \"create_guest.py\"\nVIRT_COMMAND_DELETE_GUEST = \"delete_guest.py\"\nVIRT_COMMAND_DELETE_SNAPSHOT = \"delete_snapshot.py\"\nVIRT_COMMAND_GET_MEMORY_USAGE = \"get_memory_usage.py\"\nVIRT_COMMAND_SET_MEMORY = \"set_memory.py\"\nVIRT_COMMAND_START_GUEST = \"start_guest.py\"\nVIRT_COMMAND_REBOOT_GUEST = \"reboot_guest.py\"\nVIRT_COMMAND_DESTROY_GUEST = \"destroy_guest.py\"\nVIRT_COMMAND_AUTOSTART_GUEST = \"autostart_guest.py\"\nVIRT_COMMAND_CREATE_NETWORK = \"create_network.py\"\nVIRT_COMMAND_DELETE_NETWORK = \"delete_network.py\"\nVIRT_COMMAND_UPDATE_NETWORK = \"update_network.py\"\nVIRT_COMMAND_REPLICATE_GUEST = \"replicate_guest.py\"\nVIRT_COMMAND_EXPORT_GUEST = \"export_guest.py\"\nVIRT_COMMAND_IMPORT_GUEST = \"import_guest.py\"\nVIRT_COMMAND_DELETE_EXPORT_DATA = \"delete_export_data.py\"\nVIRT_COMMAND_SET_VCPUS = \"set_vcpus.py\"\nVIRT_COMMAND_SUSPEND_GUEST = \"suspend_guest.py\"\nVIRT_COMMAND_ADD_DISK = \"add_disk.py\"\nVIRT_COMMAND_APPEND_DISK = \"append_disk.py\"\nVIRT_COMMAND_DELETE_DISK = \"delete_disk.py\"\nVIRT_COMMAND_ADD_NIC = \"add_nic.py\"\nVIRT_COMMAND_DELETE_NIC = \"delete_nic.py\"\nVIRT_COMMAND_CPUTOP = \"cputop.py\"\nVIRT_COMMAND_GET_CPU_USAGE = \"get_cpu_usage.py\"\nVIRT_COMMAND_RESUME_GUEST = \"resume_guest.py\"\nVIRT_COMMAND_SHUTDOWN_GUEST = \"shutdown_guest.py\"\nVIRT_COMMAND_TAKE_SNAPSHOT = \"take_snapshot.py\"\nVIRT_COMMAND_SET_MAC_ADDRESS = \"set_mac_address.py\"\nVIRT_COMMAND_SET_GRAPHICS = \"set_graphics.py\"\nFIREWALL_COMMAND_SAVE_FIREWALL = \"save_firewall.py\"\nFIREWALL_COMMAND_RESTORE_FIREWALL = \"restore_firewall.py\"\nUPDATE_COMMAND_SOFTWARE=\"update_software.py\"\nVIRT_COMMAND_CREATE_STORAGE_POOL = \"create_storage_pool.py\"\nVIRT_COMMAND_DELETE_STORAGE_POOL = \"delete_storage_pool.py\"\nVIRT_COMMAND_START_STORAGE_POOL = \"start_storage_pool.py\"\nVIRT_COMMAND_DESTROY_STORAGE_POOL = \"destroy_storage_pool.py\"\nVIRT_COMMAND_CREATE_STORAGE_VOLUME = \"create_storage_volume.py\"\nVIRT_COMMAND_DELETE_STORAGE_VOLUME = \"delete_storage_volume.py\"\nVIRT_COMMAND_REPLICATE_STORAGE_VOLUME = \"replicate_storage_volume.py\"\nISCSI_COMMAND_GET = \"get_iscsi.py\"\nISCSI_COMMAND_ADD = \"add_iscsi.py\"\nISCSI_COMMAND_DELETE = \"delete_iscsi.py\"\nISCSI_COMMAND_START = \"start_iscsi.py\"\nISCSI_COMMAND_STOP = \"stop_iscsi.py\"\nISCSI_COMMAND_UPDATE = \"update_iscsi.py\"\nCONFIGURE_COMMAND_READ = \"read_conf.py\"\nCONFIGURE_COMMAND_WRITE = \"write_conf.py\"\nIPTABLES_COMMAND_CONTROL = \"control_iptables.py\"\nSERVICE_COMMAND_START = \"start_service.py\"\nSERVICE_COMMAND_STOP = \"stop_service.py\"\nSERVICE_COMMAND_RESTART = \"restart_service.py\"\nSERVICE_COMMAND_AUTOSTART = \"autostart_service.py\"\nISCSI_COMMAND_READY_MOUNT = \"ready_mount.py\"\nBONDING_COMMAND_ADD = \"add_bonding.py\"\nBONDING_COMMAND_DELETE = \"delete_bonding.py\"\nNETWORK_COMMAND_RESTART = \"restart_network_interface.py\"\n\n# use for firewall library\nFIREWALL_XML_FILE = KARESANSUI_SYSCONF_DIR + \"/firewall.xml\"\nFIREWALL_USERCHAIN = \"KARESANSUI-Firewall\"\nRH_USERCHAIN = \"RH-Firewall-1-INPUT\"\n\n# Proxy Server use Status\nPROXY_ENABLE = '1'\nPROXY_DISABLE = '0'\n\n# port number\nPORT_MIN_NUMBER = 1\nPORT_MAX_NUMBER = 65535\nWELKNOWN_PORT_MIN_NUMBER = 1\nWELKNOWN_PORT_MAX_NUMBER = 1024\nUNKNOWN_PORT_MIN_NUMBER = 1025\nUNKNOWN_PORT_MAX_NUMBER = 65535\nGRAPHICS_PORT_MIN_NUMBER = 5900\nGRAPHICS_PORT_MAX_NUMBER = PORT_MAX_NUMBER\nENABLE_GRAPHICS_TYPE = ['vnc','spice']\n\n# input value length\nID_MIN_LENGTH = 1\nID_MAX_LENGTH = int(math.pow(2, 31)) - 1 # signed int max (2^31-1) SQLAlchemy SQLType.Integer\nUSER_MIN_LENGTH = 1\nUSER_MAX_LENGTH = 16\nEMAIL_MIN_LENGTH = 1 + 1 + 4\nEMAIL_MAX_LENGTH = 256\nPASSWORD_MIN_LENGTH = 5\nPASSWORD_MAX_LENGTH = 40\nLANGUAGES_MIN_LENGTH = 1\nLANGUAGES_MAX_LENGTH = 6\nTAG_MIN_LENGTH = 1\nTAG_MAX_LENGTH = 24\nSEARCH_MIN_LENGTH = 0\nSEARCH_MAX_LENGTH = 256\nPAGE_MIN_SIZE = 0\nPAGE_MAX_SIZE = int(math.pow(2, 31)) - 1 # signed int max (2^31-1)\nMACHINE_NAME_MIN_LENGTH = 1\nMACHINE_NAME_MAX_LENGTH = 256\nHYPERVISOR_MIN_SIZE = 0\nHYPERVISOR_MAX_SIZE = 2\nMEMORY_MIN_SIZE = 64\nDISK_MIN_SIZE = 1\nCHECK_DISK_QUOTA = 0.95\nDOMAIN_NAME_MIN_LENGTH = 1\nDOMAIN_NAME_MAX_LENGTH = 256\nNOTE_TITLE_MIN_LENGTH = 0\nNOTE_TITLE_MAX_LENGTH = 64\nIMAGE_EXT_LIST = [\"gif\", \"png\", \"jpeg\"]\nVCPUS_MIN_SIZE = 1\nFQDN_MIN_LENGTH = 0\nFQDN_MAX_LENGTH = 256\nCHAP_USER_MIN_LENGTH = 1\nCHAP_USER_MAX_LENGTH = 256\nCHAP_PASSWORD_MIN_LENGTH = 1\nCHAP_PASSWORD_MAX_LENGTH = 256\nSTORAGE_VOLUME_SIZE_MIN_LENGTH = 0;\nSTORAGE_VOLUME_SIZE_MAX_LENGTH = 2147483647;\nCONTINUATION_COUNT_MIN = 1;\nCONTINUATION_COUNT_MAX = 2147483647;\nPROHIBITION_PERIOD_MIN = 1;\nPROHIBITION_PERIOD_MAX = 2147483647;\nTHRESHOLD_VAL_MIN = 0;\n\nDEFAULT_KEYMAP = 'en-us'\n\n# use for storagepool\nSTORAGE_POOL_TYPE = {\"TYPE_DIR\":\"dir\",\n \"TYPE_FS\":\"fs\",\n \"TYPE_NETFS\":\"netfs\",\n \"TYPE_LOGICAL\":\"logical\",\n \"TYPE_DISK\":\"disk\",\n \"TYPE_ISCSI\":\"iscsi\",\n \"TYPE_SCSI\":\"scsi\",\n }\n\nSTORAGE_VOLUME_FORMAT = {\"TYPE_RAW\":\"raw\",\n \"TYPE_QCOW2\":\"qcow2\",\n #\"TYPE_QCOW\":\"qcow\",\n #\"TYPE_COW\":\"cow\",\n #\"TYPE_VDI\":\"vdi\",\n #\"TYPE_VMDK\":\"vmdk\",\n #\"TYPE_VPC\":\"vpc\",\n #\"TYPE_CLOOP\":\"cloop\",\n }\n\nSTORAGE_VOLUME_UNIT = {\"B\":1024**0,\n \"K\":1024**1,\n \"M\":1024**2,\n \"G\":1024**3,\n \"T\":1024**4,\n \"P\":1024**5,\n \"E\":1024**6,\n }\n\n# Disk format\nDISK_QEMU_FORMAT = {\"RAW\" : \"raw\",\n \"QCOW2\" : \"qcow2\",\n #\"QCOW\" : \"qcow\",\n #\"COW\" : \"cow\",\n #\"VMDK\" : \"vmdk\",\n }\n\nDISK_NON_QEMU_FORMAT = {\"RAW\" : \"raw\",}\n\n# use for iSCSI\nISCSI_DEVICE_DIR = \"/dev/disk/by-path\"\nISCSI_DEVICE_NAME_TPL = \"ip-%s:%s-iscsi-%s\"\nISCSI_DEFAULT_CONFIG_PATH = \"/etc/iscsi/iscsid.conf\"\nISCSI_DEFAULT_NODE_CONFIG_DIR = \"/var/lib/iscsi/nodes\"\n\nISCSI_CONFIG_KEY_AUTH_METHOD = \"node.session.auth.authmethod\"\nISCSI_CONFIG_KEY_AUTH_USER = \"node.session.auth.username\"\nISCSI_CONFIG_KEY_AUTH_PASSWORD = \"node.session.auth.password\"\nISCSI_CONFIG_KEY_SATRTUP = \"node.startup\"\nISCSI_CONFIG_VALUE_AUTH_METHOD_NONE = \"None\"\nISCSI_CONFIG_VALUE_AUTH_METHOD_CHAP = \"CHAP\"\nISCSI_CONFIG_VALUE_SATRTUP_ON = \"automatic\"\nISCSI_CONFIG_VALUE_SATRTUP_OFF = \"manual\"\nISCSI_DATA_DIR = VENDOR_DATA_DIR + \"/iscsi\"\n\nISCSI_CMD = \"/sbin/iscsiadm\"\nISCSI_CMD_OPTION_MODE = \"--mode\"\nISCSI_CMD_OPTION_MODE_NODE = \"node\"\nISCSI_CMD_OPTION_MODE_SESSION = \"session\"\nISCSI_CMD_OPTION_MODE_DISCOVERY = \"discovery\"\nISCSI_CMD_OPTION_TYPE = \"--type\"\nISCSI_CMD_OPTION_TYPE_SENDTARGETS = \"sendtargets\"\nISCSI_CMD_OPTION_OPERATOR = \"--op\"\nISCSI_CMD_OPTION_OPERATOR_DELETE = \"delete\"\nISCSI_CMD_OPTION_TARGETNAME = \"--targetname\"\nISCSI_CMD_OPTION_PORTAL = \"--portal\"\nISCSI_CMD_OPTION_LOGIN = \"--login\"\nISCSI_CMD_OPTION_LOGOUT = \"--logout\"\nISCSI_CMD_RES_NO_NODE = \"no records found\"\nISCSI_CMD_RES_NO_ACTIVE_SESSION = \"No active sessions\"\n\nDEFAULT_KVM_DISK_FORMAT = \"qcow2\"\nDEFAULT_XEN_DISK_FORMAT = \"raw\"\n\n# use for log\nLOG_EPOCH_REGEX = r\"(^[0-9]+\\.[0-9]+)\"\nLOG_SYSLOG_REGEX = r\"(^[a-zA-Z]{3} [ 0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2})\"\n\n# use for collectd\nCOLLECTD_LOG_DIR = \"/var/log/collectd\"\nCOLLECTD_DATA_DIR = \"%s/collectd\" % VENDOR_DATA_DIR\n\nCOLLECTD_PLUGIN_CPU = \"cpu\"\nCOLLECTD_PLUGIN_DF = \"df\"\nCOLLECTD_PLUGIN_DISK = \"disk\"\nCOLLECTD_PLUGIN_EXEC = \"exec\"\nCOLLECTD_PLUGIN_INTERFACE = \"interface\"\nCOLLECTD_PLUGIN_IPTABLES = \"iptables\"\nCOLLECTD_PLUGIN_LIBVIRT = \"libvirt\"\nCOLLECTD_PLUGIN_LOAD = \"load\"\nCOLLECTD_PLUGIN_LOGFILE = \"logfile\"\nCOLLECTD_PLUGIN_MEMORY = \"memory\"\nCOLLECTD_PLUGIN_NETWORK = \"network\"\nCOLLECTD_PLUGIN_PYTHON = \"python\"\nCOLLECTD_PLUGIN_RRDCACHED = \"rrdcached\"\nCOLLECTD_PLUGIN_RRDTOOL = \"rrdtool\"\nCOLLECTD_PLUGIN_SENSORS = \"sensors\"\nCOLLECTD_PLUGIN_SNMP = \"SNMP\"\nCOLLECTD_PLUGIN_SYSLOG = \"syslog\"\nCOLLECTD_PLUGIN_TAIL = \"tail\"\nCOLLECTD_PLUGIN_UPTIME = \"uptime\"\nCOLLECTD_PLUGIN_USERS = \"users\"\n\nWATCH_PLUGINS = {\"cpu\" : COLLECTD_PLUGIN_CPU,\n \"df\" : COLLECTD_PLUGIN_DF,\n \"interface\" : COLLECTD_PLUGIN_INTERFACE,\n \"libvirt\" : COLLECTD_PLUGIN_LIBVIRT,\n \"load\" : COLLECTD_PLUGIN_LOAD,\n \"memory\" : COLLECTD_PLUGIN_MEMORY,\n }\n\nCOLLECTD_CPU_TYPE = \"cpu\"\nCOLLECTD_CPU_TYPE_INSTANCE = {\"IDLE\" : \"idle\",\n \"NICE\" : \"nice\",\n \"USER\" : \"user\",\n \"WAIT\" : \"wait\",\n \"INTERRUPT\" : \"interrupt\",\n \"SOFTIRQ\" : \"softirq\",\n \"STEAL\" : \"steal\",\n \"SYSTEM\" : \"system\",\n }\nCOLLECTD_CPU_DS = \"value\"\nCOLLECTD_MEMORY_TYPE = \"memory\"\nCOLLECTD_MEMORY_TYPE_INSTANCE = {\"FREE\" : \"free\",\n \"CACHED\" : \"cached\",\n \"BUFFERED\" : \"buffered\",\n \"USED\" : \"used\",\n }\nCOLLECTD_MEMORY_DS = \"value\"\nCOLLECTD_DF_TYPE = \"df\"\nCOLLECTD_DF_DS = {\"USED\" : \"used\",\n \"FREE\" : \"free\",\n }\nCOLLECTD_DISK_TYPE = {\"MERGED\" : \"disk_merged\",\n \"OCTETS\" : \"disk_octets\",\n \"OPS\" : \"disk_ops\",\n \"TIME\" : \"disk_time\",\n }\nCOLLECTD_DISK_DS = {\"READ\" : \"read\",\n \"WRITE\" : \"write\",\n }\nCOLLECTD_INTERFACE_TYPE = {\"ERRORS\" : \"if_errors\",\n \"PACKETS\" : \"if_packets\",\n \"OCTETS\" : \"if_octets\",\n }\nCOLLECTD_INTERFACE_DS = {\"RX\" : \"rx\",\n \"TX\" : \"tx\",\n }\nCOLLECTD_UPTIME_TYPE =\"uptime\"\nCOLLECTD_UPTIME_DS = \"value\"\n\nCOLLECTD_LOAD_TYPE = \"load\"\nCOLLECTD_LOAD_DS = {\"SHORTTERM\": \"shortterm\",\n \"MIDTERM\" : \"midterm\",\n \"LONGTERM\" : \"longterm\",\n }\n\nCOLLECTD_USERS_TYPE =\"users\"\nCOLLECTD_USERS_DS = \"users\"\n\nCOLLECTD_LIBVIRT_TYPE = {\"CPU_TOTAL\" : \"virt_cpu_total\",\n \"VCPU\" : \"virt_vcpu\",\n \"DISK_OPS\" : \"disk_ops\",\n \"DISK_OCTETS\" : \"disk_octets\",\n \"IF_OCTETS\" : \"if_octets\",\n \"IF_PACKETS\" : \"if_packets\",\n \"IF_ERRORS\" : \"if_errors\",\n \"IF_DROPPED\" : \"if_dropped\",\n }\n\nCOLLECTD_DF_RRPORT_BY_DEVICE = True\n\nCOUNTUP_DATABASE_PATH = KARESANSUI_DATA_DIR + \"/notify_count.db\"\nVALUE_BOUNDS_UPPER = \"1\"\nVALUE_BOUNDS_LOWER = \"0\"\n\nHDD_TYPES_REGEX = ('sd[a-z]+[0-9]*',\n 'hd[a-z]+[0-9]*',\n )\n\nSTORAGE_POOL_PWD = {\"OWNER\":\"root\",\n \"GROUP\":\"kss\",\n \"MODE\":\"0770\",\n }\n\nSTORAGE_VOLUME_PWD = {\"OWNER\":\"root\",\n \"GROUP\":\"kss\",\n \"MODE\":\"0660\",\n }\n\nDISK_USES = {\"IMAGES\":\"images\",\n \"DISK\":\"disk\",\n }\n\n# use for mail template\nTEMPLATE_DIR = KARESANSUI_SYSCONF_DIR + \"/template\"\nMAIL_TEMPLATE_DIR_JA = TEMPLATE_DIR + \"/ja\"\nMAIL_TEMPLATE_DIR_EN = TEMPLATE_DIR + \"/en\"\nMAIL_TEMPLATE_COLLECTD_WARNING = {COLLECTD_PLUGIN_CPU:\"collectd_warning_cpu.eml\",\n COLLECTD_PLUGIN_DF:\"collectd_warning_df.eml\",\n COLLECTD_PLUGIN_DISK:\"collectd_warning_disk.eml\",\n COLLECTD_PLUGIN_INTERFACE:\"collectd_warning_interface.eml\",\n COLLECTD_PLUGIN_LIBVIRT:\"collectd_warning_libvirt.eml\",\n COLLECTD_PLUGIN_LOAD:\"collectd_warning_load.eml\",\n COLLECTD_PLUGIN_MEMORY:\"collectd_warning_memory.eml\",\n COLLECTD_PLUGIN_UPTIME:\"collectd_warning_uptime.eml\",\n COLLECTD_PLUGIN_USERS:\"collectd_warning_users.eml\",\n }\nMAIL_TEMPLATE_COLLECTD_FAILURE = {COLLECTD_PLUGIN_CPU:\"collectd_failure_cpu.eml\",\n COLLECTD_PLUGIN_DF:\"collectd_failure_df.eml\",\n COLLECTD_PLUGIN_DISK:\"collectd_failure_disk.eml\",\n COLLECTD_PLUGIN_INTERFACE:\"collectd_failure_interface.eml\",\n COLLECTD_PLUGIN_LIBVIRT:\"collectd_failure_libvirt.eml\",\n COLLECTD_PLUGIN_LOAD:\"collectd_failure_load.eml\",\n COLLECTD_PLUGIN_MEMORY:\"collectd_failure_memory.eml\",\n COLLECTD_PLUGIN_UPTIME:\"collectd_failure_uptime.eml\",\n COLLECTD_PLUGIN_USERS:\"collectd_failure_users.eml\",\n }\nMAIL_TEMPLATE_COLLECTD_OKAY = {COLLECTD_PLUGIN_CPU:\"collectd_okay_cpu.eml\",\n COLLECTD_PLUGIN_DF:\"collectd_okay_df.eml\",\n COLLECTD_PLUGIN_DISK:\"collectd_okay_disk.eml\",\n COLLECTD_PLUGIN_INTERFACE:\"collectd_okay_interface.eml\",\n COLLECTD_PLUGIN_LIBVIRT:\"collectd_okay_libvirt.eml\",\n COLLECTD_PLUGIN_LOAD:\"collectd_okay_load.eml\",\n COLLECTD_PLUGIN_MEMORY:\"collectd_okay_memory.eml\",\n COLLECTD_PLUGIN_UPTIME:\"collectd_okay_uptime.eml\",\n COLLECTD_PLUGIN_USERS:\"collectd_okay_users.eml\",\n }\n\n# use for service\nSERVICE_XML_FILE = KARESANSUI_SYSCONF_DIR + \"/service.xml\"\n\n# use for Report\nGRAPH_COMMON_PARAM = [\n \"--imgformat\", \"PNG\",\n \"--font\", \"TITLE:0:IPAexGothic\",\n \"--font\", \"LEGEND:0:IPAexGothic\",\n \"--pango-markup\",\n \"--width\", \"550\",\n \"--height\", \"350\",\n \"--full-size-mode\",\n \"--grid-dash\", \"1:0\",\n \"--color\", \"BACK#FFFFFF\",\n \"--color\", \"CANVAS#FFFFFF\",\n \"--color\", \"SHADEA#FFFFFF\",\n \"--color\", \"SHADEB#FFFFFF\",\n \"--color\", \"GRID#DDDDDD\",\n \"--color\", \"MGRID#CCCCCC\",\n \"--color\", \"FONT#555555\",\n \"--color\", \"FRAME#FFFFFF\",\n \"--color\", \"ARROW#FFFFFF\",\n ]\n# use for log viewer\nLOG_VIEW_XML_FILE = KARESANSUI_SYSCONF_DIR + \"/logview.xml\"\n\nGUEST_EXPORT_FILE = 'info.dat'\n\nKVM_BUS_TYPES = ['ide',\n #'scsi',\n 'virtio',\n ]\nXEN_BUS_TYPES = ['xen']\n\n# use for mount check\nMOUNT_CMD = \"/bin/mount\"\nUMOUNT_CMD = \"/bin/umount\"\nFORMAT_CMD = \"/sbin/mkfs\"\nYES_CMD = (\"echo\", \"y\")\n\n# interval of monitoring\n# !! This interval value is dummy.\n# !! Genuine value in collectd config file (/etc/collectd.conf).\nWATCH_INTERVAL = 10\n\n# use for network bonding\nBONDING_MODE = {\"0\" : 0,\n \"1\" : 1,\n \"2\" : 2,\n \"3\" : 3,\n \"4\" : 4,\n \"5\" : 5,\n \"6\" : 6,\n }\nBONDING_CONFIG_MII_DEFAULT = 100\nNETWORK_IFCFG_DIR = \"/etc/sysconfig/network-scripts\"\nNETWORK_COMMAND = \"/etc/init.d/network\"\nSYSTEM_COMMAND_REMOVE_MODULE = \"/sbin/rmmod\"\nNETWORK_IFDOWN_COMMAND = \"/sbin/ifdown\"\nNETWORK_BRCTL_COMMAND = \"/usr/sbin/brctl\"\nNETWORK_IFCONFIG_COMMAND = \"/sbin/ifconfig\"\n\nDEFAULT_DECIMAL_POINT = 1\n\nDEFAULT_ALERT_TRIGGER_COUNT = 3;\nDEFAULT_SLIENT_PERIOD = 300;\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import karesansui", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 17 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "Kar", "esa", "nsu", "i", " ", "Core", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "200", "9", "-", "2012", " ", "HD", "E", ",", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", " ", "obtain", "ing", " ", "a", " ", "copy_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", " ", "condition", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", " ", "include", "d", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "EXPR", "ESS", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "kar", "esa", "nsu", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "LANG", "S_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ja", "\\u", "JP", "\"_", ":_", "{_", "'", "DAT", "E", "\\u", "FORMAT", "'_", ":_", "(_", "\"%", "Y", "/", "%", "m", "/", "%", "d", "\"_", ",_", "\"%", "Y", "/", "%", "m", "/", "%", "d", " ", "%", "H", ":", "%", "M", ":", "%", "S", "\"_", ",_", "\"", "yy", "-", "mm", "-", "dd", "\"_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "en", "\\u", "US", "\"_", ":_", "{_", "'", "DAT", "E", "\\u", "FORMAT", "'_", ":_", "(_", "\"%", "m", "/", "%", "d", "/", "%", "Y", "\"_", ",_", "\"%", "m", "/", "%", "d", "/", "%", "Y", " ", "%", "H", ":", "%", "M", ":", "%", "S", "\"_", ",_", "\"", "mm", "-", "dd", "-", "yy", "\"_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"", "de", "\\u", "DE", "\":", " ", "{", "'", "DAT", "E", "\\u", "FORMAT", "'", " ", ":", " ", "(\"", "%", "m", "/", "%", "d", "/", "%", "Y", "\",", " ", "\"%", "m", "/", "%", "d", "/", "%", "Y", " ", "%", "H", ":", "%", "M", ":", "%", "S", "\",", " ", "\"", "mm", "-", "dd", "-", "yy", "\")", "},", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"", "es", "\\u", "ES", "\":", " ", "{", "'", "DAT", "E", "\\u", "FORMAT", "'", " ", ":", " ", "(\"", "%", "m", "/", "%", "d", "/", "%", "Y", "\",", " ", "\"%", "m", "/", "%", "d", "/", "%", "Y", " ", "%", "H", ":", "%", "M", ":", "%", "S", "\",", " ", "\"", "mm", "-", "dd", "-", "yy", "\")", "},", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"", "fr", "\\u", "FR", "\":", " ", "{", "'", "DAT", "E", "\\u", "FORMAT", "'", " ", ":", " ", "(\"", "%", "m", "/", "%", "d", "/", "%", "Y", "\",", " ", "\"%", "m", "/", "%", "d", "/", "%", "Y", " ", "%", "H", ":", "%", "M", ":", "%", "S", "\",", " ", "\"", "mm", "-", "dd", "-", "yy", "\")", "},", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"", "it", "\\u", "IT", "\":", " ", "{", "'", "DAT", "E", "\\u", "FORMAT", "'", " ", ":", " ", "(\"", "%", "m", "/", "%", "d", "/", "%", "Y", "\",", " ", "\"%", "m", "/", "%", "d", "/", "%", "Y", " ", "%", "H", ":", "%", "M", ":", "%", "S", "\",", " ", "\"", "mm", "-", "dd", "-", "yy", "\")", "},", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"", "ko", "\\u", "KR", "\":", " ", "{", "'", "DAT", "E", "\\u", "FORMAT", "'", " ", ":", " ", "(\"", "%", "m", "/", "%", "d", "/", "%", "Y", "\",", " ", "\"%", "m", "/", "%", "d", "/", "%", "Y", " ", "%", "H", ":", "%", "M", ":", "%", "S", "\",", " ", "\"", "mm", "-", "dd", "-", "yy", "\")", "},", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"", "pt", "\\u", "BR", "\":", " ", "{", "'", "DAT", "E", "\\u", "FORMAT", "'", " ", ":", " ", "(\"", "%", "m", "/", "%", "d", "/", "%", "Y", "\",", " ", "\"%", "m", "/", "%", "d", "/", "%", "Y", " ", "%", "H", ":", "%", "M", ":", "%", "S", "\",", " ", "\"", "mm", "-", "dd", "-", "yy", "\")", "},", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"", "ru", "\\u", "RU", "\":", " ", "{", "'", "DAT", "E", "\\u", "FORMAT", "'", " ", ":", " ", "(\"", "%", "m", "/", "%", "d", "/", "%", "Y", "\",", " ", "\"%", "m", "/", "%", "d", "/", "%", "Y", " ", "%", "H", ":", "%", "M", ":", "%", "S", "\",", " ", "\"", "mm", "-", "dd", "-", "yy", "\")", "},", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"", "zh", "\\u", "CN", "\":", " ", "{", "'", "DAT", "E", "\\u", "FORMAT", "'", " ", ":", " ", "(\"", "%", "m", "/", "%", "d", "/", "%", "Y", "\",", " ", "\"%", "m", "/", "%", "d", "/", "%", "Y", " ", "%", "H", ":", "%", "M", ":", "%", "S", "\",", " ", "\"", "mm", "-", "dd", "-", "yy", "\")", "},", "_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "DAT", "E", "\\u", "FORMAT_", "=_", "(_", "\"%", "m", "/", "%", "d", "/", "%", "Y", "\"_", ",_", "\"%", "m", "/", "%", "d", "/", "%", "Y", " ", "%", "H", ":", "%", "M", ":", "%", "S", "\"_", ",_", "\"", "mm", "/", "dd", "/", "yy", "\"_", ",_", "\"%", "Y", "/", "%", "m", "/", "%", "d", " ", "%", "H", ":", "%", "M", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "defin", "e", " ", "kar", "esa", "nsu", "i", " ", "path", "s", " ", "&", " ", "users_", "\\u\\u\\uNL\\u\\u\\u_", "KA", "RES", "AN", "SU", "I", "\\u", "USER_", "=_", "\"", "ks", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "KA", "RES", "AN", "SU", "I", "\\u", "GROUP_", "=_", "\"", "ks", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "KA", "RES", "AN", "SU", "I", "\\u", "PREFIX_", "=_", "\"/", "var", "/", "lib", "/", "kar", "esa", "nsu", "i", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "KA", "RES", "AN", "SU", "I", "\\u", "TMP", "\\u", "DIR_", "=_", "KA", "RES", "AN", "SU", "I", "\\u", "PREFIX_", "+_", "\"/", "tmp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "KA", "RES", "AN", "SU", "I", "\\u", "SYS", "CONF", "\\u", "DIR_", "=_", "\"/", "etc", "/", "kar", "esa", "nsu", "i", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "KA", "RES", "AN", "SU", "I", "\\u", "DATA", "\\u", "DIR_", "=_", "\"/", "var", "/", "lib", "/", "kar", "esa", "nsu", "i", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MACHINE", "\\u", "ATTRIBUTE_", "=_", "{_", "'", "HOST", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "GUE", "ST", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "URI", "'_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MACHINE", "\\u", "HYP", "ERV", "ISO", "R_", "=_", "{_", "'", "REAL", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "XE", "N", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "KV", "M", "'_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "URI", "'_", ":_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "defin", "e", " ", "vendor", " ", "paths_", "\\u\\u\\uNL\\u\\u\\u_", "VENDOR", "\\u", "PREFIX_", "=_", "\"/", "usr", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VENDOR", "\\u", "BIN", "\\u", "DIR_", "=_", "VENDOR", "\\u", "PREFIX_", "+_", "\"/", "bin", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VENDOR", "\\u", "SB", "IN", "\\u", "DIR_", "=_", "VENDOR", "\\u", "PREFIX_", "+_", "\"/", "sb", "in", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VENDOR", "\\u", "SYS", "CONF", "\\u", "DIR_", "=_", "\"/", "etc", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VENDOR", "\\u", "DATA", "\\u", "DIR_", "=_", "\"/", "var", "/", "lib", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VENDOR", "\\u", "DATA", "\\u", "ISCSI", "\\u", "DIR_", "=_", "\"/", "var", "/", "lib", "/", "iscsi", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VENDOR", "\\u", "DATA", "\\u", "ISCSI", "\\u", "MOUNT", "\\u", "DIR_", "=_", "VENDOR", "\\u", "DATA", "\\u", "ISCSI", "\\u", "DIR_", "+_", "\"/", "mount", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VENDOR", "\\u", "DATA", "\\u", "ISCSI", "\\u", "DOM", "AINS", "\\u", "DIR_", "=_", "VENDOR", "\\u", "DATA", "\\u", "ISCSI", "\\u", "DIR_", "+_", "\"/", "domains", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VENDOR", "\\u", "DATA", "\\u", "BON", "DING", "\\u", "EV", "AC", "UAT", "ION", "\\u", "DIR_", "=_", "\"/", "var", "/", "lib", "/", "kar", "esa", "nsu", "i", "/", "ifc", "fg", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VENDOR", "\\u", "LIB", "VIR", "T", "\\u", "RUN", "\\u", "DIR_", "=_", "\"/", "var", "/", "run", "/", "libvi", "rt", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "XE", "N", "\\u", "SYS", "CONF", "\\u", "DIR_", "=_", "\"/", "etc", "/", "xen", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "LOGO", "UT\\u", "FILE", "\\u", "PREF", "IX", " ", "=", " ", "\"%", "s", "/", "logo", "ut", ".\"", " ", "%", " ", "kar", "esa", "nsu", "i", ".", "config", "['", "applica", "tion", ".", "tmp", ".", "dir", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "LOGO", "UT\\u", "FILE", "\\u", "PREFIX_", "=_", "KA", "RES", "AN", "SU", "I", "\\u", "TMP", "\\u", "DIR_", "+_", "\"/", "logo", "ut", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ICON", "\\u", "DIR", "\\u", "TP", "L_", "=_", "\"%", "s", "/", "static", "/", "icon", "/", "%", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MS", "G", "\\u", "LIMIT_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TAG", "\\u", "CLIP", "PING", "\\u", "RANGE_", "=_", "12_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MACHINE", "\\u", "NAME", "\\u", "CLIP", "PING", "\\u", "RANGE_", "=_", "20_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "LIST", "\\u", "RANGE_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "JOB", "\\u", "LIST", "\\u", "RANGE_", "=_", "DEF", "AUL", "T", "\\u", "LIST", "\\u", "RANGE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "USER", "\\u", "LIST", "\\u", "RANGE_", "=_", "DEF", "AUL", "T", "\\u", "LIST", "\\u", "RANGE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TAG", "\\u", "LIST", "\\u", "RANGE_", "=_", "DEF", "AUL", "T", "\\u", "LIST", "\\u", "RANGE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "WATCH", "\\u", "LIST", "\\u", "RANGE_", "=_", "DEF", "AUL", "T", "\\u", "LIST", "\\u", "RANGE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAIL", "TEMPL", "ATE", "\\u", "LIST", "\\u", "RANGE_", "=_", "DEF", "AUL", "T", "\\u", "LIST", "\\u", "RANGE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "for", " ", "virt", " ", "library_", "\\u\\u\\uNL\\u\\u\\u_", "VIR", "T", "\\u", "LIB", "VIR", "T", "\\u", "DATA", "\\u", "DIR_", "=_", "\"/", "var", "/", "lib", "/", "libvi", "rt", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "XE", "ND", "OM", "AINS", "\\u", "AUTO", "\\u", "DIR_", "=_", "XE", "N", "\\u", "SYS", "CONF", "\\u", "DIR_", "+_", "\"/", "auto", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "VIR", "T", "\\u", "LIB", "VIR", "T", "\\u", "SOCKET", "\\u", "RW", "_", "=_", "VENDOR", "\\u", "LIB", "VIR", "T", "\\u", "RUN", "\\u", "DIR_", "+_", "\"/", "libvi", "rt", "-", "sock", "\"_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "LIB", "VIR", "T", "\\u", "SOCKET", "\\u", "RO", "_", "=_", "VENDOR", "\\u", "LIB", "VIR", "T", "\\u", "RUN", "\\u", "DIR_", "+_", "\"/", "libvi", "rt", "-", "sock", "-", "ro", "\"_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "kvm", "_", "\\u\\u\\uNL\\u\\u\\u_", "KV", "M", "\\u", "VIRTUAL", "\\u", "DISK", "\\u", "PREFIX_", "=_", "\"", "hd", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "KV", "M", "\\u", "VIR", "T", "\\u", "CONFIG", "\\u", "DIR_", "=_", "\"/", "etc", "/", "kar", "esa", "nsu", "i", "/", "virt", "/", "kvm", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "KV", "M", "\\u", "VIR", "T", "\\u", "URI", "\\u", "RW", " ", "=", " ", "\"", "qe", "mu", "+", "tls", "://", "127", ".0", ".0", ".1", ":", "165", "14", "/", "system", "?", "no", "\\u", "verify", "=", "1", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", "KV", "M", "\\u", "VIR", "T", "\\u", "URI", "\\u", "RO", " ", "=", " ", "\"", "qe", "mu", "+", "tls", "://", "127", ".0", ".0", ".1", ":", "165", "14", "/", "system", "?", "no", "\\u", "verify", "=", "1", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "KV", "M", "\\u", "VIR", "T", "\\u", "URI", "\\u", "RW", "_", "=_", "\"", "qe", "mu", "+", "tcp", "://", "127", ".0", ".0", ".1", ":", "165", "09", "/", "system", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "KV", "M", "\\u", "VIR", "T", "\\u", "URI", "\\u", "RO", "_", "=_", "\"", "qe", "mu", "+", "tcp", "://", "127", ".0", ".0", ".1", ":", "165", "09", "/", "system", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "KV", "M", "\\u", "KA", "RES", "AN", "SU", "I", "\\u", "TMP", "\\u", "DIR_", "=_", "KA", "RES", "AN", "SU", "I", "\\u", "TMP", "\\u", "DIR_", "+_", "\"/", "kvm", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "'/", "usr", "/", "share", "/", "qe", "mu", "-", "kvm", "/", "keymap", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "KV", "M", "\\u", "KEY", "MAP", "\\u", "DIR_", "=_", "'/", "usr", "/", "share", "/", "qe", "mu", "-", "kvm", "/", "keymap", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "KV", "M", "\\u", "KEY", "MAP", "\\u", "DIR_", "=_", "'/", "usr", "/", "share", "/", "kvm", "/", "keymap", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "KV", "M", "\\u", "BRIDGE", "\\u", "PREF", "IX", " ", "=", " ", "\"(", "eth", "|", "bond", "br", ")\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "KV", "M", "\\u", "BRIDGE", "\\u", "PREFIX_", "=_", "\"", "br", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "xen", "_", "\\u\\u\\uNL\\u\\u\\u_", "XE", "N", "\\u", "VIRTUAL", "\\u", "DISK", "\\u", "PREFIX_", "=_", "\"", "xv", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "XE", "N", "\\u", "VIR", "T", "\\u", "CONFIG", "\\u", "DIR_", "=_", "\"/", "etc", "/", "kar", "esa", "nsu", "i", "/", "virt", "/", "xen", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "XE", "N", "\\u", "VIR", "T", "\\u", "URI", "\\u", "RW", "_", "=_", "\"", "xen", ":///", "?", "socket", "=\"_", "+_", "VIR", "T", "\\u", "LIB", "VIR", "T", "\\u", "SOCKET", "\\u", "RW", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "XE", "N", "\\u", "VIR", "T", "\\u", "URI", "\\u", "RO", "_", "=_", "\"", "xen", ":///", "?", "socket", "=\"_", "+_", "VIR", "T", "\\u", "LIB", "VIR", "T", "\\u", "SOCKET", "\\u", "RO", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "XE", "N", "\\u", "KA", "RES", "AN", "SU", "I", "\\u", "TMP", "\\u", "DIR_", "=_", "KA", "RES", "AN", "SU", "I", "\\u", "TMP", "\\u", "DIR_", "+_", "\"/", "xen", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "XE", "N", "\\u", "KEY", "MAP", "\\u", "DIR_", "=_", "'/", "usr", "/", "share", "/", "xen", "/", "qe", "mu", "/", "keymap", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "VIR", "T", "\\u", "XML", "\\u", "CONFIG", "\\u", "DIR_", "=_", "VENDOR", "\\u", "SYS", "CONF", "\\u", "DIR_", "+_", "\"/", "libvi", "rt", "/", "qe", "mu", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "VIR", "T", "\\u", "SYS", "CONF", "\\u", "DIR_", "=_", "VENDOR", "\\u", "SYS", "CONF", "\\u", "DIR_", "+_", "\"/", "libvi", "rt", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OLD", "\\u", "VIR", "T", "\\u", "DISK", "\\u", "DIR_", "=_", "VIR", "T", "\\u", "LIB", "VIR", "T", "\\u", "DATA", "\\u", "DIR_", "+_", "\"/", "disk", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OLD", "\\u", "VIR", "T", "\\u", "DISK", "\\u", "IMA", "GE", "\\u", "DIR_", "=_", "VIR", "T", "\\u", "LIB", "VIR", "T", "\\u", "DATA", "\\u", "DIR_", "+_", "\"/", "images", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OLD", "\\u", "VIR", "T", "\\u", "BOOT", "\\u", "IMA", "GE", "\\u", "DIR_", "=_", "VIR", "T", "\\u", "LIB", "VIR", "T", "\\u", "DATA", "\\u", "DIR_", "+_", "\"/", "boot", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OLD", "\\u", "VIR", "T", "\\u", "SNAPSHOT", "\\u", "DIR_", "=_", "VIR", "T", "\\u", "LIB", "VIR", "T", "\\u", "DATA", "\\u", "DIR_", "+_", "\"/", "snapshot", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "DOM", "AINS", "\\u", "DIR_", "=_", "VIR", "T", "\\u", "LIB", "VIR", "T", "\\u", "DATA", "\\u", "DIR_", "+_", "\"/", "domains", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "QE", "MU", "\\u", "DIR_", "=_", "VIR", "T", "\\u", "LIB", "VIR", "T", "\\u", "DATA", "\\u", "DIR_", "+_", "\"/", "qe", "mu", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "SNAPSHOT", "\\u", "DIR_", "=_", "VIR", "T", "\\u", "QE", "MU", "\\u", "DIR_", "+_", "\"/", "snapshot", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "NET", "WORK", "\\u", "CONFIG", "\\u", "DIR_", "=_", "VIR", "T", "\\u", "SYS", "CONF", "\\u", "DIR_", "+_", "\"/", "qe", "mu", "/", "network", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "AUTOS", "TAR", "T", "\\u", "CONFIG", "\\u", "DIR_", "=_", "VIR", "T", "\\u", "SYS", "CONF", "\\u", "DIR_", "+_", "\"/", "qe", "mu", "/", "autostart", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "LIB", "VIR", "TD", "\\u", "CONFIG", "\\u", "FILE_", "=_", "VIR", "T", "\\u", "SYS", "CONF", "\\u", "DIR_", "+_", "\"/", "libvi", "rtd", ".", "conf", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "STOR", "AGE", "\\u", "CONFIG", "\\u", "DIR_", "=_", "VIR", "T", "\\u", "SYS", "CONF", "\\u", "DIR_", "+_", "\"/", "storage", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "STOR", "AGE", "\\u", "AUTOS", "TAR", "T", "\\u", "CONFIG", "\\u", "DIR_", "=_", "VIR", "T", "\\u", "SYS", "CONF", "\\u", "DIR_", "+_", "\"/", "storage", "/", "autostart", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "virt", " ", "command_", "\\u\\u\\uNL\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "APPL", "Y", "\\u", "SNAPSHOT", "_", "=_", "\"", "appl", "y", "\\u", "snapshot", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "CREATE", "\\u", "GUE", "ST_", "=_", "\"", "create", "\\u", "guest", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "DELET", "E", "\\u", "GUE", "ST_", "=_", "\"", "delete", "\\u", "guest", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "DELET", "E", "\\u", "SNAPSHOT", "_", "=_", "\"", "delete", "\\u", "snapshot", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "GET", "\\u", "MEM", "ORY", "\\u", "USAGE", "_", "=_", "\"", "get", "\\u", "memory", "\\u", "usage", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "SET", "\\u", "MEM", "ORY", "_", "=_", "\"", "set\\u", "memory", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "START", "\\u", "GUE", "ST_", "=_", "\"", "start", "\\u", "guest", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "REB", "OOT", "\\u", "GUE", "ST_", "=_", "\"", "rebo", "ot", "\\u", "guest", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "DEST", "ROY", "\\u", "GUE", "ST_", "=_", "\"", "destroy", "\\u", "guest", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "AUTOS", "TAR", "T", "\\u", "GUE", "ST_", "=_", "\"", "autostart", "\\u", "guest", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "CREATE", "\\u", "NETWORK_", "=_", "\"", "create", "\\u", "network", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "DELET", "E", "\\u", "NETWORK_", "=_", "\"", "delete", "\\u", "network", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "UPDATE", "\\u", "NETWORK_", "=_", "\"", "update", "\\u", "network", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "REPLICA", "TE", "\\u", "GUE", "ST_", "=_", "\"", "replicate", "\\u", "guest", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "EXPORT", "\\u", "GUE", "ST_", "=_", "\"", "export", "\\u", "guest", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "IMPORT", "\\u", "GUE", "ST_", "=_", "\"", "import", "\\u", "guest", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "DELET", "E", "\\u", "EXPORT", "\\u", "DATA_", "=_", "\"", "delete", "\\u", "export", "\\u", "data", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "SET", "\\u", "VC", "PU", "S_", "=_", "\"", "set\\u", "vcpu", "s", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "SUS", "PEND", "\\u", "GUE", "ST_", "=_", "\"", "suspend", "\\u", "guest", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "ADD", "\\u", "DISK", "_", "=_", "\"", "add", "\\u", "disk", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "APPEN", "D", "\\u", "DISK", "_", "=_", "\"", "append", "\\u", "disk", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "DELET", "E", "\\u", "DISK", "_", "=_", "\"", "delete", "\\u", "disk", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "ADD", "\\u", "NIC", "_", "=_", "\"", "add", "\\u", "nic", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "DELET", "E", "\\u", "NIC", "_", "=_", "\"", "delete", "\\u", "nic", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "CPU", "TOP_", "=_", "\"", "cpu", "top", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "GET", "\\u", "CPU", "\\u", "USAGE", "_", "=_", "\"", "get", "\\u", "cpu", "\\u", "usage", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "RESU", "ME", "\\u", "GUE", "ST_", "=_", "\"", "resum", "e\\u", "guest", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "SHUTDOWN", "\\u", "GUE", "ST_", "=_", "\"", "shut", "down", "\\u", "guest", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "TA", "KE", "\\u", "SNAPSHOT", "_", "=_", "\"", "take", "\\u", "snapshot", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "SET", "\\u", "MAC", "\\u", "ADDRESS_", "=_", "\"", "set\\u", "mac", "\\u", "address", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "SET", "\\u", "GRAPHI", "CS_", "=_", "\"", "set\\u", "graphic", "s", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FIRE", "WALL", "\\u", "COMMA", "ND", "\\u", "SAVE", "\\u", "FIRE", "WALL", "_", "=_", "\"", "save", "\\u", "firew", "all", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FIRE", "WALL", "\\u", "COMMA", "ND", "\\u", "REST", "ORE", "\\u", "FIRE", "WALL", "_", "=_", "\"", "restore", "\\u", "firew", "all", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "UPDATE", "\\u", "COMMA", "ND", "\\u", "SOFT", "WARE", "_", "=_", "\"", "update", "\\u", "software", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "CREATE", "\\u", "STOR", "AGE", "\\u", "POOL", "_", "=_", "\"", "create", "\\u", "storage", "\\u", "pool", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "DELET", "E", "\\u", "STOR", "AGE", "\\u", "POOL", "_", "=_", "\"", "delete", "\\u", "storage", "\\u", "pool", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "START", "\\u", "STOR", "AGE", "\\u", "POOL", "_", "=_", "\"", "start", "\\u", "storage", "\\u", "pool", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "DEST", "ROY", "\\u", "STOR", "AGE", "\\u", "POOL", "_", "=_", "\"", "destroy", "\\u", "storage", "\\u", "pool", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "CREATE", "\\u", "STOR", "AGE", "\\u", "VOLUME_", "=_", "\"", "create", "\\u", "storage", "\\u", "volume", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "DELET", "E", "\\u", "STOR", "AGE", "\\u", "VOLUME_", "=_", "\"", "delete", "\\u", "storage", "\\u", "volume", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "REPLICA", "TE", "\\u", "STOR", "AGE", "\\u", "VOLUME_", "=_", "\"", "replicate", "\\u", "storage", "\\u", "volume", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "COMMA", "ND", "\\u", "GET_", "=_", "\"", "get", "\\u", "iscsi", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "COMMA", "ND", "\\u", "ADD_", "=_", "\"", "add", "\\u", "iscsi", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "COMMA", "ND", "\\u", "DELETE_", "=_", "\"", "delete", "\\u", "iscsi", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "COMMA", "ND", "\\u", "START_", "=_", "\"", "start", "\\u", "iscsi", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "COMMA", "ND", "\\u", "STOP_", "=_", "\"", "stop", "\\u", "iscsi", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "COMMA", "ND", "\\u", "UPDATE_", "=_", "\"", "update", "\\u", "iscsi", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONFIG", "URE", "\\u", "COMMA", "ND", "\\u", "READ_", "=_", "\"", "read", "\\u", "conf", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONFIG", "URE", "\\u", "COMMA", "ND", "\\u", "WRITE_", "=_", "\"", "write", "\\u", "conf", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "IP", "TABLES", "\\u", "COMMA", "ND", "\\u", "CONTROL_", "=_", "\"", "control", "\\u", "iptables", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SERV", "ICE", "\\u", "COMMA", "ND", "\\u", "START_", "=_", "\"", "start", "\\u", "service", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SERV", "ICE", "\\u", "COMMA", "ND", "\\u", "STOP_", "=_", "\"", "stop", "\\u", "service", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SERV", "ICE", "\\u", "COMMA", "ND", "\\u", "RESTA", "RT_", "=_", "\"", "restart", "\\u", "service", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SERV", "ICE", "\\u", "COMMA", "ND", "\\u", "AUTOS", "TAR", "T_", "=_", "\"", "autostart", "\\u", "service", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "COMMA", "ND", "\\u", "READY", "\\u", "MOUNT", "_", "=_", "\"", "read", "y", "\\u", "mount", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BON", "DING", "\\u", "COMMA", "ND", "\\u", "ADD_", "=_", "\"", "add", "\\u", "bond", "ing", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BON", "DING", "\\u", "COMMA", "ND", "\\u", "DELETE_", "=_", "\"", "delete", "\\u", "bond", "ing", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NET", "WORK", "\\u", "COMMA", "ND", "\\u", "RESTA", "RT_", "=_", "\"", "restart", "\\u", "network", "\\u", "interface", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "for", " ", "firew", "all", " ", "library_", "\\u\\u\\uNL\\u\\u\\u_", "FIRE", "WALL", "\\u", "XML", "\\u", "FILE_", "=_", "KA", "RES", "AN", "SU", "I", "\\u", "SYS", "CONF", "\\u", "DIR_", "+_", "\"/", "firew", "all", ".", "xml", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FIRE", "WALL", "\\u", "USER", "CHAIN", "_", "=_", "\"", "KA", "RES", "AN", "SU", "I", "-", "Fire", "wall", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RH", "\\u", "USER", "CHAIN", "_", "=_", "\"", "RH", "-", "Fire", "wall", "-1", "-", "INPUT", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pro", "xy", " ", "Server", " ", "use", " ", "Status_", "\\u\\u\\uNL\\u\\u\\u_", "PROX", "Y", "\\u", "ENABLE", "_", "=_", "'", "1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PROX", "Y", "\\u", "DISABLE", "_", "=_", "'", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "port", " ", "number_", "\\u\\u\\uNL\\u\\u\\u_", "PORT", "\\u", "MIN", "\\u", "NUMBER_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PORT", "\\u", "MAX", "\\u", "NUMBER_", "=_", "65535_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "WEL", "KNOWN", "\\u", "PORT", "\\u", "MIN", "\\u", "NUMBER_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "WEL", "KNOWN", "\\u", "PORT", "\\u", "MAX", "\\u", "NUMBER_", "=_", "1024_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "UNK", "NOW", "N", "\\u", "PORT", "\\u", "MIN", "\\u", "NUMBER_", "=_", "1025", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "UNK", "NOW", "N", "\\u", "PORT", "\\u", "MAX", "\\u", "NUMBER_", "=_", "65535_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "GRAPHI", "CS", "\\u", "PORT", "\\u", "MIN", "\\u", "NUMBER_", "=_", "590", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "GRAPHI", "CS", "\\u", "PORT", "\\u", "MAX", "\\u", "NUMBER_", "=_", "PORT", "\\u", "MAX", "\\u", "NUMBER_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ENABLE", "\\u", "GRAPHI", "CS", "\\u", "TYPE_", "=_", "[_", "'", "vnc", "'_", ",_", "'", "spice", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "input", " ", "value", " ", "length_", "\\u\\u\\uNL\\u\\u\\u_", "ID", "\\u", "MIN", "\\u", "LENGTH_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ID", "\\u", "MAX", "\\u", "LENGTH_", "=_", "int_", "(_", "math_", "._", "pow_", "(_", "2_", ",_", "31_", ")_", ")_", "-_", "1_", "#", " ", "sign", "ed", " ", "int", " ", "max", " ", "(", "2", "^", "3", "1", "-1", ")", " ", "SQL", "Al", "chem", "y", " ", "SQL", "Type", ".", "Integer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "USER", "\\u", "MIN", "\\u", "LENGTH_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "USER", "\\u", "MAX", "\\u", "LENGTH_", "=_", "16_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EMA", "IL", "\\u", "MIN", "\\u", "LENGTH_", "=_", "1_", "+_", "1_", "+_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EMA", "IL", "\\u", "MAX", "\\u", "LENGTH_", "=_", "256_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PASS", "WORD", "\\u", "MIN", "\\u", "LENGTH_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PASS", "WORD", "\\u", "MAX", "\\u", "LENGTH_", "=_", "40_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LANGUAGE", "S", "\\u", "MIN", "\\u", "LENGTH_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LANGUAGE", "S", "\\u", "MAX", "\\u", "LENGTH_", "=_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TAG", "\\u", "MIN", "\\u", "LENGTH_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TAG", "\\u", "MAX", "\\u", "LENGTH_", "=_", "24_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SEARCH", "\\u", "MIN", "\\u", "LENGTH_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SEARCH", "\\u", "MAX", "\\u", "LENGTH_", "=_", "256_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PAGE", "\\u", "MIN", "\\u", "SIZE_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PAGE", "\\u", "MAX", "\\u", "SIZE_", "=_", "int_", "(_", "math_", "._", "pow_", "(_", "2_", ",_", "31_", ")_", ")_", "-_", "1_", "#", " ", "sign", "ed", " ", "int", " ", "max", " ", "(", "2", "^", "3", "1", "-1", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MACHINE", "\\u", "NAME", "\\u", "MIN", "\\u", "LENGTH_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MACHINE", "\\u", "NAME", "\\u", "MAX", "\\u", "LENGTH_", "=_", "256_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HYP", "ERV", "ISO", "R", "\\u", "MIN", "\\u", "SIZE_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HYP", "ERV", "ISO", "R", "\\u", "MAX", "\\u", "SIZE_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MEM", "ORY", "\\u", "MIN", "\\u", "SIZE_", "=_", "64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DISK", "\\u", "MIN", "\\u", "SIZE_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CHECK", "\\u", "DISK", "\\u", "QUOTA", "_", "=_", "0.95_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DOM", "AIN", "\\u", "NAME", "\\u", "MIN", "\\u", "LENGTH_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DOM", "AIN", "\\u", "NAME", "\\u", "MAX", "\\u", "LENGTH_", "=_", "256_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NOTE", "\\u", "TIT", "LE", "\\u", "MIN", "\\u", "LENGTH_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NOTE", "\\u", "TIT", "LE", "\\u", "MAX", "\\u", "LENGTH_", "=_", "64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "IMA", "GE", "\\u", "EXT", "\\u", "LIST_", "=_", "[_", "\"", "gif", "\"_", ",_", "\"", "png", "\"_", ",_", "\"", "jpeg", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VC", "PU", "S", "\\u", "MIN", "\\u", "SIZE_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FQ", "DN", "\\u", "MIN", "\\u", "LENGTH_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FQ", "DN", "\\u", "MAX", "\\u", "LENGTH_", "=_", "256_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CHA", "P", "\\u", "USER", "\\u", "MIN", "\\u", "LENGTH_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CHA", "P", "\\u", "USER", "\\u", "MAX", "\\u", "LENGTH_", "=_", "256_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CHA", "P", "\\u", "PASS", "WORD", "\\u", "MIN", "\\u", "LENGTH_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CHA", "P", "\\u", "PASS", "WORD", "\\u", "MAX", "\\u", "LENGTH_", "=_", "256_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STOR", "AGE", "\\u", "VOLUM", "E", "\\u", "SIZE", "\\u", "MIN", "\\u", "LENGTH_", "=_", "0_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STOR", "AGE", "\\u", "VOLUM", "E", "\\u", "SIZE", "\\u", "MAX", "\\u", "LENGTH_", "=_", "2147483647", "_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONTI", "NU", "ATION", "\\u", "COUNT", "\\u", "MIN_", "=_", "1_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONTI", "NU", "ATION", "\\u", "COUNT", "\\u", "MAX_", "=_", "2147483647", "_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PRO", "HI", "BIT", "ION", "\\u", "PERIOD", "\\u", "MIN_", "=_", "1_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PRO", "HI", "BIT", "ION", "\\u", "PERIOD", "\\u", "MAX_", "=_", "2147483647", "_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "THRESH", "OLD", "\\u", "VAL", "\\u", "MIN_", "=_", "0_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "KEY", "MAP_", "=_", "'", "en", "-", "us", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "for", " ", "storage", "pool_", "\\u\\u\\uNL\\u\\u\\u_", "STOR", "AGE", "\\u", "POOL", "\\u", "TYPE_", "=_", "{_", "\"", "TYPE", "\\u", "DIR", "\"_", ":_", "\"", "dir", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "TYPE", "\\u", "FS", "\"_", ":_", "\"", "fs", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "TYPE", "\\u", "NET", "FS", "\"_", ":_", "\"", "netf", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "TYPE", "\\u", "LOGI", "CAL", "\"_", ":_", "\"", "logical", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "TYPE", "\\u", "DISK", "\"_", ":_", "\"", "disk", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "TYPE", "\\u", "ISCSI", "\"_", ":_", "\"", "iscsi", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "TYPE", "\\u", "SCS", "I", "\"_", ":_", "\"", "scs", "i", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "STOR", "AGE", "\\u", "VOLUM", "E", "\\u", "FORMAT_", "=_", "{_", "\"", "TYPE", "\\u", "RA", "W", "\"_", ":_", "\"", "raw", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "TYPE", "\\u", "QC", "OW", "2", "\"_", ":_", "\"", "qcow", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "TYPE", "\\u", "QC", "OW", "\":\"", "qcow", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "TYPE", "\\u", "CO", "W", "\":\"", "cow", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "TYPE", "\\u", "VDI", "\":\"", "vdi", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "TYPE", "\\u", "VM", "DK", "\":\"", "vmd", "k", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "TYPE", "\\u", "VP", "C", "\":\"", "vpc", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "TYPE", "\\u", "CLO", "OP", "\":\"", "clo", "op", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "STOR", "AGE", "\\u", "VOLUM", "E", "\\u", "UNIT", "_", "=_", "{_", "\"", "B", "\"_", ":_", "1024_", "**_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "K", "\"_", ":_", "1024_", "**_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "M", "\"_", ":_", "1024_", "**_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "G", "\"_", ":_", "1024_", "**_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "T", "\"_", ":_", "1024_", "**_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "P", "\"_", ":_", "1024_", "**_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "E", "\"_", ":_", "1024_", "**_", "6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Disk", " ", "format_", "\\u\\u\\uNL\\u\\u\\u_", "DISK", "\\u", "QE", "MU", "\\u", "FORMAT_", "=_", "{_", "\"", "RA", "W", "\"_", ":_", "\"", "raw", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "QC", "OW", "2", "\"_", ":_", "\"", "qcow", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "QC", "OW", "\"", " ", ":", " ", "\"", "qcow", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "CO", "W", "\"", " ", ":", " ", "\"", "cow", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "VM", "DK", "\"", " ", ":", " ", "\"", "vmd", "k", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DISK", "\\u", "NON", "\\u", "QE", "MU", "\\u", "FORMAT_", "=_", "{_", "\"", "RA", "W", "\"_", ":_", "\"", "raw", "\"_", ",_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "for", " ", "i", "SCS", "I_", "\\u\\u\\uNL\\u\\u\\u_", "ISCSI", "\\u", "DEV", "ICE", "\\u", "DIR_", "=_", "\"/", "dev", "/", "disk", "/", "by", "-", "path", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "DEV", "ICE", "\\u", "NAME", "\\u", "TP", "L_", "=_", "\"", "ip", "-%", "s", ":", "%", "s", "-", "iscsi", "-%", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "DEF", "AUL", "T", "\\u", "CONFIG", "\\u", "PATH_", "=_", "\"/", "etc", "/", "iscsi", "/", "iscsi", "d", ".", "conf", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "DEF", "AUL", "T", "\\u", "NODE", "\\u", "CONFIG", "\\u", "DIR_", "=_", "\"/", "var", "/", "lib", "/", "iscsi", "/", "nodes", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ISCSI", "\\u", "CONFIG", "\\u", "KEY", "\\u", "AUTH", "\\u", "METHOD_", "=_", "\"", "node", ".", "session", ".", "auth", ".", "auth", "method", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "CONFIG", "\\u", "KEY", "\\u", "AUTH", "\\u", "USER_", "=_", "\"", "node", ".", "session", ".", "auth", ".", "user", "name", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "CONFIG", "\\u", "KEY", "\\u", "AUTH", "\\u", "PASSWORD_", "=_", "\"", "node", ".", "session", ".", "auth", ".", "password", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "CONFIG", "\\u", "KEY", "\\u", "SAT", "RT", "UP_", "=_", "\"", "node", ".", "start", "up", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "CONFIG", "\\u", "VALU", "E", "\\u", "AUTH", "\\u", "METH", "OD", "\\u", "NONE_", "=_", "\"", "Non", "e", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "CONFIG", "\\u", "VALU", "E", "\\u", "AUTH", "\\u", "METH", "OD", "\\u", "CHA", "P_", "=_", "\"", "CHA", "P", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "CONFIG", "\\u", "VALU", "E", "\\u", "SAT", "RT", "UP", "\\u", "ON_", "=_", "\"", "automati", "c", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "CONFIG", "\\u", "VALU", "E", "\\u", "SAT", "RT", "UP", "\\u", "OFF_", "=_", "\"", "manu", "al", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "DATA", "\\u", "DIR_", "=_", "VENDOR", "\\u", "DATA", "\\u", "DIR_", "+_", "\"/", "iscsi", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ISCSI", "\\u", "CMD_", "=_", "\"/", "sb", "in", "/", "iscsi", "adm", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "CMD", "\\u", "OPTION", "\\u", "MODE_", "=_", "\"--", "mode", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "CMD", "\\u", "OPTION", "\\u", "MODE", "\\u", "NODE_", "=_", "\"", "node", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "CMD", "\\u", "OPTION", "\\u", "MODE", "\\u", "SESSION_", "=_", "\"", "session", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "CMD", "\\u", "OPTION", "\\u", "MODE", "\\u", "DISCO", "VERY", "_", "=_", "\"", "discove", "ry", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "CMD", "\\u", "OPTION", "\\u", "TYPE_", "=_", "\"--", "type", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "CMD", "\\u", "OPTION", "\\u", "TYPE", "\\u", "SEND", "TARGET", "S_", "=_", "\"", "send", "target", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "CMD", "\\u", "OPTION", "\\u", "OPERATOR", "_", "=_", "\"--", "op", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "CMD", "\\u", "OPTION", "\\u", "OPERATOR", "\\u", "DELETE_", "=_", "\"", "delete", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "CMD", "\\u", "OPTION", "\\u", "TARGET", "NAME_", "=_", "\"--", "target", "name", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "CMD", "\\u", "OPTION", "\\u", "PORT", "AL_", "=_", "\"--", "portal", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "CMD", "\\u", "OPTION", "\\u", "LOGIN", "_", "=_", "\"--", "login", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "CMD", "\\u", "OPTION", "\\u", "LOGO", "UT_", "=_", "\"--", "logo", "ut", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "CMD", "\\u", "RES", "\\u", "NO", "\\u", "NODE_", "=_", "\"", "no", " ", "record", "s", " ", "found", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ISCSI", "\\u", "CMD", "\\u", "RES", "\\u", "NO", "\\u", "ACTI", "VE", "\\u", "SESSION_", "=_", "\"", "No", " ", "active", " ", "session", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "KV", "M", "\\u", "DISK", "\\u", "FORMAT_", "=_", "\"", "qcow", "2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "XE", "N", "\\u", "DISK", "\\u", "FORMAT_", "=_", "\"", "raw", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "for", " ", "log_", "\\u\\u\\uNL\\u\\u\\u_", "LOG", "\\u", "EPOCH", "\\u", "REGEX_", "=_", "r", "\"(", "^", "[", "0", "-", "9", "]+\\\\", ".", "[", "0", "-", "9", "]+)\"", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG", "\\u", "SYS", "LOG", "\\u", "REGEX_", "=_", "r", "\"(", "^", "[", "a", "-", "z", "A", "-", "Z", "]{", "3", "}", " ", "[", " ", "0", "-", "9", "]{", "2", "}", " ", "[", "0", "-", "9", "]{", "2", "}:", "[", "0", "-", "9", "]{", "2", "}:", "[", "0", "-", "9", "]{", "2", "})\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "for", " ", "collectd", "_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "LOG", "\\u", "DIR_", "=_", "\"/", "var", "/", "log", "/", "collectd", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "DATA", "\\u", "DIR_", "=_", "\"%", "s", "/", "collectd", "\"_", "%_", "VENDOR", "\\u", "DATA", "\\u", "DIR_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "CPU_", "=_", "\"", "cpu", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "DF_", "=_", "\"", "df", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "DISK", "_", "=_", "\"", "disk", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "EXEC", "_", "=_", "\"", "exec", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "INTERFACE_", "=_", "\"", "interface", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "IP", "TABLES", "_", "=_", "\"", "iptables", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "LIB", "VIR", "T_", "=_", "\"", "libvi", "rt", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "LOAD", "_", "=_", "\"", "load", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "LOG", "FILE_", "=_", "\"", "logfile", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "MEM", "ORY", "_", "=_", "\"", "memory", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "NETWORK_", "=_", "\"", "network", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "PYTHON", "_", "=_", "\"", "python", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "RR", "DC", "ACH", "ED_", "=_", "\"", "rrd", "cache", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "RR", "DT", "OO", "L_", "=_", "\"", "rrd", "tool", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "SENSOR", "S_", "=_", "\"", "sensor", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "SN", "MP_", "=_", "\"", "SN", "MP", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "SYS", "LOG_", "=_", "\"", "syslo", "g", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "TAI", "L_", "=_", "\"", "tail", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "UP", "TIME_", "=_", "\"", "upti", "me", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "USERS", "_", "=_", "\"", "users", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "WATCH", "\\u", "PLUGINS", "_", "=_", "{_", "\"", "cpu", "\"_", ":_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "CPU_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "df", "\"_", ":_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "DF_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "interface", "\"_", ":_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "INTERFACE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "libvi", "rt", "\"_", ":_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "LIB", "VIR", "T_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "load", "\"_", ":_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "LOAD", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "memory", "\"_", ":_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "MEM", "ORY", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "CPU", "\\u", "TYPE_", "=_", "\"", "cpu", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "CPU", "\\u", "TYPE", "\\u", "INSTANCE", "_", "=_", "{_", "\"", "IDLE", "\"_", ":_", "\"", "idle", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "NIC", "E", "\"_", ":_", "\"", "nice", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "USER", "\"_", ":_", "\"", "user", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "WAIT", "\"_", ":_", "\"", "wait", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "INTER", "RU", "PT", "\"_", ":_", "\"", "interrupt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "SOFT", "IR", "Q", "\"_", ":_", "\"", "soft", "irq", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "STE", "AL", "\"_", ":_", "\"", "stea", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "SYSTEM", "\"_", ":_", "\"", "system", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "CPU", "\\u", "DS_", "=_", "\"", "value", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "MEM", "ORY", "\\u", "TYPE_", "=_", "\"", "memory", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "MEM", "ORY", "\\u", "TYPE", "\\u", "INSTANCE", "_", "=_", "{_", "\"", "FREE", "\"_", ":_", "\"", "free", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CACHE", "D", "\"_", ":_", "\"", "cache", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "BUFF", "ERE", "D", "\"_", ":_", "\"", "buffered", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "USED", "\"_", ":_", "\"", "used", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "MEM", "ORY", "\\u", "DS_", "=_", "\"", "value", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "DF", "\\u", "TYPE_", "=_", "\"", "df", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "DF", "\\u", "DS_", "=_", "{_", "\"", "USED", "\"_", ":_", "\"", "used", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "FREE", "\"_", ":_", "\"", "free", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "DISK", "\\u", "TYPE_", "=_", "{_", "\"", "MERGE", "D", "\"_", ":_", "\"", "disk", "\\u", "merge", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "OCT", "ET", "S", "\"_", ":_", "\"", "disk", "\\u", "octets", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "OPS", "\"_", ":_", "\"", "disk", "\\u", "ops", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "TIME", "\"_", ":_", "\"", "disk", "\\u", "time", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "DISK", "\\u", "DS_", "=_", "{_", "\"", "READ", "\"_", ":_", "\"", "read", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "WRITE", "\"_", ":_", "\"", "write", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "INTERFACE", "\\u", "TYPE_", "=_", "{_", "\"", "ERRORS", "\"_", ":_", "\"", "if", "\\u", "error", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "PACKET", "S", "\"_", ":_", "\"", "if", "\\u", "packet", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "OCT", "ET", "S", "\"_", ":_", "\"", "if", "\\u", "octets", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "INTERFACE", "\\u", "DS_", "=_", "{_", "\"", "RX", "\"_", ":_", "\"", "rx", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "TX", "\"_", ":_", "\"", "tx", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "UP", "TIME", "\\u", "TYPE_", "=_", "\"", "upti", "me", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "UP", "TIME", "\\u", "DS_", "=_", "\"", "value", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "LOAD", "\\u", "TYPE_", "=_", "\"", "load", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "LOAD", "\\u", "DS_", "=_", "{_", "\"", "SHORT", "TERM", "\"_", ":_", "\"", "short", "term", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "MID", "TERM", "\"_", ":_", "\"", "mid", "term", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "LONG", "TERM", "\"_", ":_", "\"", "long", "term", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "USERS", "\\u", "TYPE_", "=_", "\"", "users", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "USERS", "\\u", "DS_", "=_", "\"", "users", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "LIB", "VIR", "T", "\\u", "TYPE_", "=_", "{_", "\"", "CPU", "\\u", "TOTAL", "\"_", ":_", "\"", "virt", "\\u", "cpu", "\\u", "total", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "VC", "PU", "\"_", ":_", "\"", "virt", "\\u", "vcpu", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "DISK", "\\u", "OPS", "\"_", ":_", "\"", "disk", "\\u", "ops", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "DISK", "\\u", "OCT", "ET", "S", "\"_", ":_", "\"", "disk", "\\u", "octets", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "IF", "\\u", "OCT", "ET", "S", "\"_", ":_", "\"", "if", "\\u", "octets", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "IF", "\\u", "PACKET", "S", "\"_", ":_", "\"", "if", "\\u", "packet", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "IF", "\\u", "ERRORS", "\"_", ":_", "\"", "if", "\\u", "error", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "IF", "\\u", "DROP", "PED", "\"_", ":_", "\"", "if", "\\u", "dropped", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "DF", "\\u", "RR", "PORT", "\\u", "BY", "\\u", "DEVICE_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "COUNT", "UP", "\\u", "DATA", "BASE", "\\u", "PATH_", "=_", "KA", "RES", "AN", "SU", "I", "\\u", "DATA", "\\u", "DIR_", "+_", "\"/", "notif", "y", "\\u", "count", ".", "db", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VALU", "E", "\\u", "BOUND", "S", "\\u", "UPPER", "_", "=_", "\"", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VALU", "E", "\\u", "BOUND", "S", "\\u", "LOWER", "_", "=_", "\"", "0", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "HD", "D", "\\u", "TYPES", "\\u", "REGEX_", "=_", "(_", "'", "sd", "[", "a", "-", "z", "]+", "[", "0", "-", "9", "]*'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hd", "[", "a", "-", "z", "]+", "[", "0", "-", "9", "]*'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "STOR", "AGE", "\\u", "POOL", "\\u", "PWD", "_", "=_", "{_", "\"", "OWNER", "\"_", ":_", "\"", "root", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "GROU", "P", "\"_", ":_", "\"", "ks", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "MODE", "\"_", ":_", "\"", "077", "0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "STOR", "AGE", "\\u", "VOLUM", "E", "\\u", "PWD", "_", "=_", "{_", "\"", "OWNER", "\"_", ":_", "\"", "root", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "GROU", "P", "\"_", ":_", "\"", "ks", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "MODE", "\"_", ":_", "\"", "066", "0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DISK", "\\u", "USE", "S_", "=_", "{_", "\"", "IMAGES", "\"_", ":_", "\"", "images", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "DISK", "\"_", ":_", "\"", "disk", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "for", " ", "mail", " ", "template_", "\\u\\u\\uNL\\u\\u\\u_", "TEMPL", "ATE", "\\u", "DIR_", "=_", "KA", "RES", "AN", "SU", "I", "\\u", "SYS", "CONF", "\\u", "DIR_", "+_", "\"/", "template", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAIL", "\\u", "TEMPL", "ATE", "\\u", "DIR", "\\u", "JA", "_", "=_", "TEMPL", "ATE", "\\u", "DIR_", "+_", "\"/", "ja", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAIL", "\\u", "TEMPL", "ATE", "\\u", "DIR", "\\u", "EN_", "=_", "TEMPL", "ATE", "\\u", "DIR_", "+_", "\"/", "en", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAIL", "\\u", "TEMPL", "ATE", "\\u", "COLL", "ECT", "D", "\\u", "WARNING_", "=_", "{_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "CPU_", ":_", "\"", "collectd", "\\u", "warn", "ing", "\\u", "cpu", ".", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "DF_", ":_", "\"", "collectd", "\\u", "warn", "ing", "\\u", "df", ".", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "DISK", "_", ":_", "\"", "collectd", "\\u", "warn", "ing", "\\u", "disk", ".", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "INTERFACE_", ":_", "\"", "collectd", "\\u", "warn", "ing", "\\u", "interface", ".", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "LIB", "VIR", "T_", ":_", "\"", "collectd", "\\u", "warn", "ing", "\\u", "libvi", "rt", ".", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "LOAD", "_", ":_", "\"", "collectd", "\\u", "warn", "ing", "\\u", "load", ".", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "MEM", "ORY", "_", ":_", "\"", "collectd", "\\u", "warn", "ing", "\\u", "memory", ".", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "UP", "TIME_", ":_", "\"", "collectd", "\\u", "warn", "ing", "\\u", "upti", "me", ".", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "USERS", "_", ":_", "\"", "collectd", "\\u", "warn", "ing", "\\u", "users", ".", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAIL", "\\u", "TEMPL", "ATE", "\\u", "COLL", "ECT", "D", "\\u", "FAILURE_", "=_", "{_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "CPU_", ":_", "\"", "collectd", "\\u", "fail", "ure", "\\u", "cpu", ".", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "DF_", ":_", "\"", "collectd", "\\u", "fail", "ure", "\\u", "df", ".", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "DISK", "_", ":_", "\"", "collectd", "\\u", "fail", "ure", "\\u", "disk", ".", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "INTERFACE_", ":_", "\"", "collectd", "\\u", "fail", "ure", "\\u", "interface", ".", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "LIB", "VIR", "T_", ":_", "\"", "collectd", "\\u", "fail", "ure", "\\u", "libvi", "rt", ".", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "LOAD", "_", ":_", "\"", "collectd", "\\u", "fail", "ure", "\\u", "load", ".", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "MEM", "ORY", "_", ":_", "\"", "collectd", "\\u", "fail", "ure", "\\u", "memory", ".", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "UP", "TIME_", ":_", "\"", "collectd", "\\u", "fail", "ure", "\\u", "upti", "me", ".", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "USERS", "_", ":_", "\"", "collectd", "\\u", "fail", "ure", "\\u", "users", ".", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAIL", "\\u", "TEMPL", "ATE", "\\u", "COLL", "ECT", "D", "\\u", "OK", "AY", "_", "=_", "{_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "CPU_", ":_", "\"", "collectd", "\\u", "oka", "y", "\\u", "cpu", ".", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "DF_", ":_", "\"", "collectd", "\\u", "oka", "y", "\\u", "df", ".", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "DISK", "_", ":_", "\"", "collectd", "\\u", "oka", "y", "\\u", "disk", ".", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "INTERFACE_", ":_", "\"", "collectd", "\\u", "oka", "y", "\\u", "interface", ".", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "LIB", "VIR", "T_", ":_", "\"", "collectd", "\\u", "oka", "y", "\\u", "libvi", "rt", ".", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "LOAD", "_", ":_", "\"", "collectd", "\\u", "oka", "y", "\\u", "load", ".", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "MEM", "ORY", "_", ":_", "\"", "collectd", "\\u", "oka", "y", "\\u", "memory", ".", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "UP", "TIME_", ":_", "\"", "collectd", "\\u", "oka", "y", "\\u", "upti", "me", ".", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "COLL", "ECT", "D", "\\u", "PLUGIN", "\\u", "USERS", "_", ":_", "\"", "collectd", "\\u", "oka", "y", "\\u", "users", ".", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "for", " ", "service_", "\\u\\u\\uNL\\u\\u\\u_", "SERV", "ICE", "\\u", "XML", "\\u", "FILE_", "=_", "KA", "RES", "AN", "SU", "I", "\\u", "SYS", "CONF", "\\u", "DIR_", "+_", "\"/", "service", ".", "xml", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "for", " ", "Report_", "\\u\\u\\uNL\\u\\u\\u_", "GRAPH", "\\u", "COMMON", "\\u", "PARAM_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "img", "format", "\"_", ",_", "\"", "PNG", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "font", "\"_", ",_", "\"", "TIT", "LE", ":", "0", ":", "IPA", "ex", "Got", "hic", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "font", "\"_", ",_", "\"", "LE", "GEN", "D", ":", "0", ":", "IPA", "ex", "Got", "hic", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "pango", "-", "markup", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "widt", "h", "\"_", ",_", "\"", "550", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "height", "\"_", ",_", "\"", "350", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "full", "-", "size", "-", "mode", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "grid", "-", "dash", "\"_", ",_", "\"", "1", ":", "0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "color", "\"_", ",_", "\"", "BACK", "#", "FFFF", "FF", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "color", "\"_", ",_", "\"", "CAN", "VA", "S", "#", "FFFF", "FF", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "color", "\"_", ",_", "\"", "SHADE", "A", "#", "FFFF", "FF", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "color", "\"_", ",_", "\"", "SHADE", "B", "#", "FFFF", "FF", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "color", "\"_", ",_", "\"", "GRID", "#", "DDD", "DDD", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "color", "\"_", ",_", "\"", "MG", "RID", "#", "CCCC", "CC", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "color", "\"_", ",_", "\"", "FONT", "#", "555555", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "color", "\"_", ",_", "\"", "FRAME", "#", "FFFF", "FF", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "color", "\"_", ",_", "\"", "ARROW", "#", "FFFF", "FF", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "use", " ", "for", " ", "log", " ", "viewer_", "\\u\\u\\uNL\\u\\u\\u_", "LOG", "\\u", "VIEW", "\\u", "XML", "\\u", "FILE_", "=_", "KA", "RES", "AN", "SU", "I", "\\u", "SYS", "CONF", "\\u", "DIR_", "+_", "\"/", "log", "view", ".", "xml", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "GUE", "ST", "\\u", "EXPORT", "\\u", "FILE_", "=_", "'", "info", ".", "dat", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "KV", "M", "\\u", "BUS", "\\u", "TYPES_", "=_", "[_", "'", "ide", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "scs", "i", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "'", "virt", "io", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "XE", "N", "\\u", "BUS", "\\u", "TYPES_", "=_", "[_", "'", "xen", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "for", " ", "mount", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "MOUNT", "\\u", "CMD_", "=_", "\"/", "bin", "/", "mount", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "UM", "OUN", "T", "\\u", "CMD_", "=_", "\"/", "bin", "/", "umount", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FORMAT", "\\u", "CMD_", "=_", "\"/", "sb", "in", "/", "mkf", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "YE", "S", "\\u", "CMD_", "=_", "(_", "\"", "echo", "\"_", ",_", "\"", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "interval", " ", "of", " ", "monitorin", "g_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "!!", " ", "Thi", "s", " ", "interval", " ", "value", " ", "is", " ", "dummy", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "!!", " ", "Gen", "uin", "e", " ", "value", " ", "in", " ", "collectd", " ", "config", " ", "file", " ", "(/", "etc", "/", "collectd", ".", "conf", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "WATCH", "\\u", "INTERVAL_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "for", " ", "network", " ", "bond", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "BON", "DING", "\\u", "MODE_", "=_", "{_", "\"", "0", "\"_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "1", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "2", "\"_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "3", "\"_", ":_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "4", "\"_", ":_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "5", "\"_", ":_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "6", "\"_", ":_", "6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BON", "DING", "\\u", "CONFIG", "\\u", "MI", "I", "\\u", "DEFAULT_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NET", "WORK", "\\u", "IF", "CF", "G", "\\u", "DIR_", "=_", "\"/", "etc", "/", "sysconfig", "/", "network", "-", "scripts", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NET", "WORK", "\\u", "COMMAND_", "=_", "\"/", "etc", "/", "init", ".", "d", "/", "network", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SYSTEM", "\\u", "COMMA", "ND", "\\u", "REMOVE", "\\u", "MODULE_", "=_", "\"/", "sb", "in", "/", "rm", "mod", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NET", "WORK", "\\u", "IF", "DOWN", "\\u", "COMMAND_", "=_", "\"/", "sb", "in", "/", "if", "down", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NET", "WORK", "\\u", "BR", "CTL", "\\u", "COMMAND_", "=_", "\"/", "usr", "/", "sb", "in", "/", "br", "ctl", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NET", "WORK", "\\u", "IF", "CONFIG", "\\u", "COMMAND_", "=_", "\"/", "sb", "in", "/", "ifconfig", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "DECIMAL", "\\u", "POINT_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "ALERT", "\\u", "TRIGGER", "\\u", "COUNT_", "=_", "3_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "SLI", "ENT", "\\u", "PERIOD_", "=_", "300_", ";_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
ioflo/ioflo/ioflo/aio/http/test/test_clienting.py
[ { "content": " def testNonBlockingRequestEcho(self):\n \"\"\"\n Test NonBlocking Http client\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testNonBlockingRequestEcho.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n beta = tcp.Client(ha=alpha.eha, bufsize=131072, wlog=wireLogBeta)\n self.assertIs(beta.reopen(), True)\n self.assertIs(beta.accepted, False)\n self.assertIs(beta.connected, False)\n self.assertIs(beta.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.serviceConnect()\n alpha.serviceConnects()\n if beta.connected and beta.ca in alpha.ixes:\n break\n time.sleep(0.05)\n\n self.assertIs(beta.accepted, True)\n self.assertIs(beta.connected, True)\n self.assertIs(beta.cutoff, False)\n self.assertEqual(beta.ca, beta.cs.getsockname())\n self.assertEqual(beta.ha, beta.cs.getpeername())\n self.assertEqual(alpha.eha, beta.ha)\n\n ixBeta = alpha.ixes[beta.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.ca)\n self.assertEqual(ixBeta.ha, beta.ha)\n\n console.terse(\"{0}\\n\".format(\"Building Request ...\\n\"))\n host = u'127.0.0.1'\n port = 6101\n method = u'GET'\n path = u'/echo?name=fame'\n console.terse(\"{0} from {1}:{2}{3} ...\\n\".format(method, host, port, path))\n headers = odict([(u'Accept', u'application/json')])\n request = clienting.Requester(hostname=host,\n port=port,\n method=method,\n path=path,\n headers=headers)\n msgOut = request.build()\n lines = [\n b'GET /echo?name=fame HTTP/1.1',\n b'Host: 127.0.0.1:6101',\n b'Accept-Encoding: identity',\n b'Accept: application/json',\n b'',\n b'',\n ]\n for i, line in enumerate(lines):\n self.assertEqual(line, request.lines[i])\n\n self.assertEqual(request.head, b'GET /echo?name=fame HTTP/1.1\\r\\nHost: 127.0.0.1:6101\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n self.assertEqual(msgOut, b'GET /echo?name=fame HTTP/1.1\\r\\nHost: 127.0.0.1:6101\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n\n console.terse(\"Beta requests to Alpha\\n\")\n beta.tx(msgOut)\n while beta.txes and not ixBeta.rxbs :\n beta.serviceTxes()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n msgOut = b'HTTP/1.1 200 OK\\r\\nContent-Length: 122\\r\\nContent-Type: application/json\\r\\nDate: Thu, 30 Apr 2015 19:37:17 GMT\\r\\nServer: IoBook.local\\r\\n\\r\\n{\"content\": null, \"query\": {\"name\": \"fame\"}, \"verb\": \"GET\", \"url\": \"http://127.0.0.1:8080/echo?name=fame\", \"action\": null}'\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.rxbs:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceReceives()\n time.sleep(0.05)\n msgIn = bytes(beta.rxbs)\n self.assertEqual(msgIn, msgOut)\n\n console.terse(\"Beta processes response \\n\")\n response = clienting.Respondent(msg=beta.rxbs, method=method)\n while response.parser:\n response.parse()\n\n response.dictify()\n\n #self.assertEqual(bytes(response.body), b'{\"content\": null, \"query\": {\"name\": \"fame\"}, \"verb\": \"GET\", \"url\": \"http://127.0.0.1:8080/echo?name=fame\", \"action\": null}')\n self.assertEqual(bytes(response.body), b'')\n self.assertEqual(response.data, {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'})\n self.assertEqual(len(beta.rxbs), 0)\n self.assertEqual(response.headers.items(), [('content-length', '122'),\n ('content-type', 'application/json'),\n ('date', 'Thu, 30 Apr 2015 19:37:17 GMT'),\n ('server', 'IoBook.local')])\n\n alpha.close()\n beta.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testNonBlockingRequestEcho", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 68 }, { "content": " def testNonBlockingRequestStream(self):\n \"\"\"\n Test NonBlocking Http client with SSE streaming server\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testNonBlockingRequestStream.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n beta = tcp.Client(ha=alpha.eha, bufsize=131072, wlog=wireLogBeta)\n self.assertIs(beta.reopen(), True)\n self.assertIs(beta.accepted, False)\n self.assertIs(beta.connected, False)\n self.assertIs(beta.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.serviceConnect()\n alpha.serviceConnects()\n if beta.connected and beta.ca in alpha.ixes:\n break\n time.sleep(0.05)\n\n self.assertIs(beta.accepted, True)\n self.assertIs(beta.connected, True)\n self.assertIs(beta.cutoff, False)\n self.assertEqual(beta.ca, beta.cs.getsockname())\n self.assertEqual(beta.ha, beta.cs.getpeername())\n self.assertEqual(alpha.eha, beta.ha)\n\n ixBeta = alpha.ixes[beta.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.ca)\n self.assertEqual(ixBeta.ha, beta.ha)\n\n console.terse(\"{0}\\n\".format(\"Building Request ...\\n\"))\n host = u'127.0.0.1'\n port = 6061\n method = u'GET'\n path = u'/stream'\n console.terse(\"{0} from {1}:{2}{3} ...\\n\".format(method, host, port, path))\n headers = odict([(u'Accept', u'application/json')])\n request = clienting.Requester(hostname=host,\n port=port,\n method=method,\n path=path,\n headers=headers)\n msgOut = request.build()\n lines = [\n b'GET /stream HTTP/1.1',\n b'Host: 127.0.0.1:6061',\n b'Accept-Encoding: identity',\n b'Accept: application/json',\n b'',\n b'',\n ]\n for i, line in enumerate(lines):\n self.assertEqual(line, request.lines[i])\n\n self.assertEqual(request.head, b'GET /stream HTTP/1.1\\r\\nHost: 127.0.0.1:6061\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n self.assertEqual(msgOut, request.head)\n\n console.terse(\"Beta requests to Alpha\\n\")\n beta.tx(msgOut)\n while beta.txes and not ixBeta.rxbs :\n beta.serviceTxes()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n lines = [\n b'HTTP/1.0 200 OK\\r\\n',\n b'Server: PasteWSGIServer/0.5 Python/2.7.9\\r\\n',\n b'Date: Thu, 30 Apr 2015 21:35:25 GMT\\r\\n'\n b'Content-Type: text/event-stream\\r\\n',\n b'Cache-Control: no-cache\\r\\n',\n b'Connection: close\\r\\n\\r\\n',\n ]\n\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.rxbs:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceReceives()\n time.sleep(0.05)\n msgIn = bytes(beta.rxbs)\n self.assertEqual(msgIn, msgOut)\n\n console.terse(\"Beta processes response \\n\")\n response = clienting.Respondent(msg=beta.rxbs, method=method)\n\n lines = [\n b'retry: 1000\\n\\n',\n b'data: START\\n\\n',\n b'data: 1\\n\\n',\n b'data: 2\\n\\n',\n b'data: 3\\n\\n',\n b'data: 4\\n\\n',\n ]\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n timer = Timer(duration=0.5)\n while response.parser and not timer.expired:\n alpha.serviceTxesAllIx()\n response.parse()\n beta.serviceReceives()\n time.sleep(0.01)\n\n if response.parser:\n response.parser.close()\n response.parser = None\n\n response.dictify()\n\n self.assertEqual(len(beta.rxbs), 0)\n self.assertEqual(response.eventSource.retry, 1000)\n self.assertEqual(response.retry, response.eventSource.retry)\n self.assertEqual(response.eventSource.leid, None)\n self.assertEqual(response.leid, response.eventSource.leid)\n self.assertTrue(len(response.events) > 2)\n event = response.events.popleft()\n self.assertEqual(event, {'id': None, 'name': '', 'data': 'START'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': None, 'name': '', 'data': '1'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': None, 'name': '', 'data': '2'})\n self.assertTrue(len(response.body) == 0)\n self.assertTrue(len(response.eventSource.raw) == 0)\n\n alpha.close()\n beta.close()\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testNonBlockingRequestStream", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 192 }, { "content": " def testNonBlockingRequestStreamChunked(self):\n \"\"\"\n Test NonBlocking Http client with SSE streaming server with transfer encoding (chunked)\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testNonBlockingRequestStreamChunked.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n beta = tcp.Client(ha=alpha.eha, bufsize=131072, wlog=wireLogBeta)\n self.assertIs(beta.reopen(), True)\n self.assertIs(beta.accepted, False)\n self.assertIs(beta.connected, False)\n self.assertIs(beta.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.serviceConnect()\n alpha.serviceConnects()\n if beta.connected and beta.ca in alpha.ixes:\n break\n time.sleep(0.05)\n\n self.assertIs(beta.accepted, True)\n self.assertIs(beta.connected, True)\n self.assertIs(beta.cutoff, False)\n self.assertEqual(beta.ca, beta.cs.getsockname())\n self.assertEqual(beta.ha, beta.cs.getpeername())\n self.assertEqual(alpha.eha, beta.ha)\n\n ixBeta = alpha.ixes[beta.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.ca)\n self.assertEqual(ixBeta.ha, beta.ha)\n\n console.terse(\"{0}\\n\".format(\"Building Request ...\\n\"))\n host = u'127.0.0.1'\n port = 6061\n method = u'GET'\n path = u'/stream'\n console.terse(\"{0} from {1}:{2}{3} ...\\n\".format(method, host, port, path))\n headers = odict([(u'Accept', u'application/json')])\n request = clienting.Requester(hostname=host,\n port=port,\n method=method,\n path=path,\n headers=headers)\n msgOut = request.build()\n lines = [\n b'GET /stream HTTP/1.1',\n b'Host: 127.0.0.1:6061',\n b'Accept-Encoding: identity',\n b'Accept: application/json',\n b'',\n b'',\n ]\n for i, line in enumerate(lines):\n self.assertEqual(line, request.lines[i])\n\n self.assertEqual(request.head, b'GET /stream HTTP/1.1\\r\\nHost: 127.0.0.1:6061\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n self.assertEqual(msgOut, request.head)\n\n console.terse(\"Beta requests to Alpha\\n\")\n beta.tx(msgOut)\n while beta.txes and not ixBeta.rxbs :\n beta.serviceTxes()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n lines = [\n b'HTTP/1.1 200 OK\\r\\n',\n b'Content-Type: text/event-stream\\r\\n',\n b'Cache-Control: no-cache\\r\\n',\n b'Transfer-Encoding: chunked\\r\\n',\n b'Date: Thu, 30 Apr 2015 20:11:35 GMT\\r\\n',\n b'Server: IoBook.local\\r\\n\\r\\n',\n ]\n\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.rxbs:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceReceives()\n time.sleep(0.05)\n msgIn = bytes(beta.rxbs)\n self.assertEqual(msgIn, msgOut)\n\n console.terse(\"Beta processes response \\n\")\n response = clienting.Respondent(msg=beta.rxbs, method=method)\n\n lines = [\n b'd\\r\\nretry: 1000\\n\\n\\r\\n',\n b'd\\r\\ndata: START\\n\\n\\r\\n',\n b'9\\r\\ndata: 1\\n\\n\\r\\n',\n b'9\\r\\ndata: 2\\n\\n\\r\\n',\n b'9\\r\\ndata: 3\\n\\n\\r\\n',\n b'9\\r\\ndata: 4\\n\\n\\r\\n',\n ]\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n timer = Timer(duration=0.5)\n while response.parser and not timer.expired:\n alpha.serviceTxesAllIx()\n response.parse()\n beta.serviceReceives()\n time.sleep(0.01)\n\n if response.parser:\n response.parser.close()\n response.parser = None\n\n response.dictify()\n\n self.assertEqual(len(beta.rxbs), 0)\n self.assertEqual(response.eventSource.retry, 1000)\n self.assertEqual(response.retry, response.eventSource.retry)\n self.assertEqual(response.eventSource.leid, None)\n self.assertEqual(response.leid, response.eventSource.leid)\n self.assertTrue(len(response.events) > 2)\n event = response.events.popleft()\n self.assertEqual(event, {'id': None, 'name': '', 'data': 'START'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': None, 'name': '', 'data': '1'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': None, 'name': '', 'data': '2'})\n self.assertTrue(len(response.body) == 0)\n self.assertTrue(len(response.eventSource.raw) == 0)\n\n alpha.close()\n beta.close()\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testNonBlockingRequestStreamChunked", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 345 }, { "content": " def testNonBlockingRequestStreamFancy(self):\n \"\"\"\n Test NonBlocking Http client to SSE server\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testNonBlockingRequestStreamFancy.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n beta = tcp.Client(ha=alpha.eha, bufsize=131072, wlog=wireLogBeta)\n self.assertIs(beta.reopen(), True)\n self.assertIs(beta.accepted, False)\n self.assertIs(beta.connected, False)\n self.assertIs(beta.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.serviceConnect()\n alpha.serviceConnects()\n if beta.connected and beta.ca in alpha.ixes:\n break\n time.sleep(0.05)\n\n self.assertIs(beta.accepted, True)\n self.assertIs(beta.connected, True)\n self.assertIs(beta.cutoff, False)\n self.assertEqual(beta.ca, beta.cs.getsockname())\n self.assertEqual(beta.ha, beta.cs.getpeername())\n self.assertEqual(alpha.eha, beta.ha)\n\n ixBeta = alpha.ixes[beta.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.ca)\n self.assertEqual(ixBeta.ha, beta.ha)\n\n console.terse(\"{0}\\n\".format(\"Building Request ...\\n\"))\n host = u'127.0.0.1'\n port = 6061\n method = u'GET'\n path = u'/fancy?idify=true&multiply=true'\n console.terse(\"{0} from {1}:{2}{3} ...\\n\".format(method, host, port, path))\n headers = odict([(u'Accept', u'application/json')])\n request = clienting.Requester(hostname=host,\n port=port,\n method=method,\n path=path,\n headers=headers)\n msgOut = request.build()\n lines = [\n b'GET /fancy?idify=true&multiply=true HTTP/1.1',\n b'Host: 127.0.0.1:6061',\n b'Accept-Encoding: identity',\n b'Accept: application/json',\n b'',\n b'',\n ]\n for i, line in enumerate(lines):\n self.assertEqual(line, request.lines[i])\n\n self.assertEqual(request.head, b'GET /fancy?idify=true&multiply=true HTTP/1.1\\r\\nHost: 127.0.0.1:6061\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n self.assertEqual(msgOut, request.head)\n\n console.terse(\"Beta requests to Alpha\\n\")\n beta.tx(msgOut)\n while beta.txes and not ixBeta.rxbs :\n beta.serviceTxes()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n lines = [\n b'HTTP/1.0 200 OK\\r\\n',\n b'Server: PasteWSGIServer/0.5 Python/2.7.9\\r\\n',\n b'Date: Thu, 30 Apr 2015 21:35:25 GMT\\r\\n'\n b'Content-Type: text/event-stream\\r\\n',\n b'Cache-Control: no-cache\\r\\n',\n b'Connection: close\\r\\n\\r\\n',\n ]\n\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.rxbs:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceReceives()\n time.sleep(0.05)\n msgIn = bytes(beta.rxbs)\n self.assertEqual(msgIn, msgOut)\n\n console.terse(\"Beta processes response \\n\")\n response = clienting.Respondent(msg=beta.rxbs, method=method)\n\n lines = [\n b'retry: 1000\\n\\n',\n b'id: 0\\ndata: START\\n\\n',\n b'id: 1\\ndata: 1\\ndata: 2\\n\\n',\n b'id: 2\\ndata: 3\\ndata: 4\\n\\n',\n b'id: 3\\ndata: 5\\ndata: 6\\n\\n',\n b'id: 4\\ndata: 7\\ndata: 8\\n\\n',\n ]\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n timer = Timer(duration=0.5)\n while response.parser and not timer.expired:\n alpha.serviceTxesAllIx()\n response.parse()\n beta.serviceReceives()\n time.sleep(0.01)\n\n if response.parser:\n response.parser.close()\n response.parser = None\n\n response.dictify()\n\n self.assertEqual(len(beta.rxbs), 0)\n self.assertEqual(response.eventSource.retry, 1000)\n self.assertEqual(response.retry, response.eventSource.retry)\n self.assertTrue(int(response.eventSource.leid) >= 2)\n self.assertEqual(response.leid, response.eventSource.leid)\n self.assertTrue(len(response.events) > 2)\n event = response.events.popleft()\n self.assertEqual(event, {'id': '0', 'name': '', 'data': 'START'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': '1', 'name': '', 'data': '1\\n2'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': '2', 'name': '', 'data': '3\\n4'})\n self.assertTrue(len(response.body) == 0)\n self.assertTrue(len(response.eventSource.raw) == 0)\n\n alpha.close()\n beta.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testNonBlockingRequestStreamFancy", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 498 }, { "content": " def testNonBlockingRequestStreamFancyChunked(self):\n \"\"\"\n Test NonBlocking Http client to server Fancy SSE with chunked transfer encoding\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testNonBlockingRequestStreamFancyChunked.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n beta = tcp.Client(ha=alpha.eha, bufsize=131072, wlog=wireLogBeta)\n self.assertIs(beta.reopen(), True)\n self.assertIs(beta.accepted, False)\n self.assertIs(beta.connected, False)\n self.assertIs(beta.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.serviceConnect()\n alpha.serviceConnects()\n if beta.connected and beta.ca in alpha.ixes:\n break\n time.sleep(0.05)\n\n self.assertIs(beta.accepted, True)\n self.assertIs(beta.connected, True)\n self.assertIs(beta.cutoff, False)\n self.assertEqual(beta.ca, beta.cs.getsockname())\n self.assertEqual(beta.ha, beta.cs.getpeername())\n self.assertEqual(alpha.eha, beta.ha)\n\n ixBeta = alpha.ixes[beta.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.ca)\n self.assertEqual(ixBeta.ha, beta.ha)\n\n console.terse(\"{0}\\n\".format(\"Building Request ...\\n\"))\n host = u'127.0.0.1'\n port = 6061\n method = u'GET'\n path = u'/fancy?idify=true&multiply=true'\n console.terse(\"{0} from {1}:{2}{3} ...\\n\".format(method, host, port, path))\n headers = odict([(u'Accept', u'application/json')])\n request = clienting.Requester(hostname=host,\n port=port,\n method=method,\n path=path,\n headers=headers)\n\n msgOut = request.build()\n lines = [\n b'GET /fancy?idify=true&multiply=true HTTP/1.1',\n b'Host: 127.0.0.1:6061',\n b'Accept-Encoding: identity',\n b'Accept: application/json',\n b'',\n b'',\n ]\n for i, line in enumerate(lines):\n self.assertEqual(line, request.lines[i])\n\n self.assertEqual(request.head, b'GET /fancy?idify=true&multiply=true HTTP/1.1\\r\\nHost: 127.0.0.1:6061\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n self.assertEqual(msgOut, request.head)\n\n console.terse(\"Beta requests to Alpha\\n\")\n beta.tx(msgOut)\n while beta.txes and not ixBeta.rxbs :\n beta.serviceTxes()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n lines = [\n b'HTTP/1.1 200 OK\\r\\n',\n b'Content-Type: text/event-stream\\r\\n',\n b'Cache-Control: no-cache\\r\\n',\n b'Transfer-Encoding: chunked\\r\\n',\n b'Date: Thu, 30 Apr 2015 22:11:53 GMT\\r\\n',\n b'Server: IoBook.local\\r\\n\\r\\n',\n ]\n\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.rxbs:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceReceives()\n time.sleep(0.05)\n msgIn = bytes(beta.rxbs)\n self.assertEqual(msgIn, msgOut)\n\n console.terse(\"Beta processes response \\n\")\n response = clienting.Respondent(msg=beta.rxbs, method=method)\n\n lines = [\n b'd\\r\\nretry: 1000\\n\\n\\r\\n',\n b'6\\r\\nid: 0\\n\\r\\n',\n b'd\\r\\ndata: START\\n\\n\\r\\n',\n b'6\\r\\nid: 1\\n\\r\\n',\n b'8\\r\\ndata: 1\\n\\r\\n',\n b'8\\r\\ndata: 2\\n\\r\\n',\n b'1\\r\\n\\n\\r\\n',\n b'6\\r\\nid: 2\\n\\r\\n',\n b'8\\r\\ndata: 3\\n\\r\\n',\n b'8\\r\\ndata: 4\\n\\r\\n',\n b'1\\r\\n\\n\\r\\n',\n b'6\\r\\nid: 3\\n\\r\\n',\n b'8\\r\\ndata: 5\\n\\r\\n',\n b'8\\r\\ndata: 6\\n\\r\\n',\n b'1\\r\\n\\n\\r\\n',\n b'6\\r\\nid: 4\\n\\r\\n8\\r\\ndata: 7\\n\\r\\n8\\r\\ndata: 8\\n\\r\\n',\n b'1\\r\\n\\n\\r\\n',\n ]\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n timer = Timer(duration=0.5)\n while response.parser and not timer.expired:\n alpha.serviceTxesAllIx()\n response.parse()\n beta.serviceReceives()\n time.sleep(0.01)\n\n if response.parser:\n response.parser.close()\n response.parser = None\n\n response.dictify()\n\n self.assertEqual(len(beta.rxbs), 0)\n self.assertEqual(response.eventSource.retry, 1000)\n self.assertEqual(response.retry, response.eventSource.retry)\n self.assertTrue(int(response.eventSource.leid) >= 2)\n self.assertEqual(response.leid, response.eventSource.leid)\n self.assertTrue(len(response.events) > 2)\n event = response.events.popleft()\n self.assertEqual(event, {'id': '0', 'name': '', 'data': 'START'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': '1', 'name': '', 'data': '1\\n2'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': '2', 'name': '', 'data': '3\\n4'})\n self.assertTrue(len(response.body) == 0)\n self.assertTrue(len(response.eventSource.raw) == 0)\n\n alpha.close()\n beta.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testNonBlockingRequestStreamFancyChunked", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 652 }, { "content": " def testNonBlockingRequestStreamFancyJson(self):\n \"\"\"\n Test NonBlocking Http client to server Fancy SSE with chunked transfer encoding\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testNonBlockingRequestStreamFancyJson.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n beta = tcp.Client(ha=alpha.eha, bufsize=131072, wlog=wireLogBeta)\n self.assertIs(beta.reopen(), True)\n self.assertIs(beta.accepted, False)\n self.assertIs(beta.connected, False)\n self.assertIs(beta.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.serviceConnect()\n alpha.serviceConnects()\n if beta.connected and beta.ca in alpha.ixes:\n break\n time.sleep(0.05)\n\n self.assertIs(beta.accepted, True)\n self.assertIs(beta.connected, True)\n self.assertIs(beta.cutoff, False)\n self.assertEqual(beta.ca, beta.cs.getsockname())\n self.assertEqual(beta.ha, beta.cs.getpeername())\n self.assertEqual(alpha.eha, beta.ha)\n\n ixBeta = alpha.ixes[beta.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.ca)\n self.assertEqual(ixBeta.ha, beta.ha)\n\n console.terse(\"{0}\\n\".format(\"Building Request ...\\n\"))\n host = u'127.0.0.1'\n port = 6061\n method = u'GET'\n path = u'/fancy?idify=true&jsonify=true'\n console.terse(\"{0} from {1}:{2}{3} ...\\n\".format(method, host, port, path))\n headers = odict([(u'Accept', u'application/json')])\n request = clienting.Requester(hostname=host,\n port=port,\n method=method,\n path=path,\n headers=headers)\n msgOut = request.build()\n lines = [\n b'GET /fancy?idify=true&jsonify=true HTTP/1.1',\n b'Host: 127.0.0.1:6061',\n b'Accept-Encoding: identity',\n b'Accept: application/json',\n b'',\n b'',\n ]\n for i, line in enumerate(lines):\n self.assertEqual(line, request.lines[i])\n\n self.assertEqual(request.head, b'GET /fancy?idify=true&jsonify=true HTTP/1.1\\r\\nHost: 127.0.0.1:6061\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n self.assertEqual(msgOut, request.head)\n\n console.terse(\"Beta requests to Alpha\\n\")\n beta.tx(msgOut)\n while beta.txes and not ixBeta.rxbs :\n beta.serviceTxes()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n lines = [\n b'HTTP/1.0 200 OK\\r\\n',\n b'Server: PasteWSGIServer/0.5 Python/2.7.9\\r\\n',\n b'Date: Thu, 30 Apr 2015 21:35:25 GMT\\r\\n'\n b'Content-Type: text/event-stream\\r\\n',\n b'Cache-Control: no-cache\\r\\n',\n b'Connection: close\\r\\n\\r\\n',\n ]\n\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.rxbs:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceReceives()\n time.sleep(0.05)\n msgIn = bytes(beta.rxbs)\n self.assertEqual(msgIn, msgOut)\n\n console.terse(\"Beta processes response \\n\")\n response = clienting.Respondent(msg=beta.rxbs,\n method=method,\n dictable=True,\n )\n\n lines = [\n b'retry: 1000\\n\\n',\n b'id: 0\\ndata: START\\n\\n',\n b'id: 1\\ndata: {\"count\":1}\\n\\n',\n b'id: 2\\n',\n b'data: {\"count\":2}\\n\\n',\n b'id: 3\\ndata: {\"count\":3}\\n\\n',\n b'id: 4\\ndata: {\"count\":4}\\n\\n',\n ]\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n timer = Timer(duration=0.5)\n while response.parser and not timer.expired:\n alpha.serviceTxesAllIx()\n response.parse()\n beta.serviceReceives()\n time.sleep(0.01)\n\n if response.parser:\n response.parser.close()\n response.parser = None\n\n self.assertEqual(len(beta.rxbs), 0)\n self.assertEqual(response.eventSource.retry, 1000)\n self.assertEqual(response.retry, response.eventSource.retry)\n self.assertTrue(int(response.eventSource.leid) >= 2)\n self.assertEqual(response.leid, response.eventSource.leid)\n self.assertTrue(len(response.events) > 2)\n event = response.events.popleft()\n self.assertEqual(event, {'id': '0', 'name': '', 'data': 'START'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': '1', 'name': '', 'data': {'count': 1}})\n event = response.events.popleft()\n self.assertEqual(event, {'id': '2', 'name': '', 'data': {'count': 2}})\n self.assertTrue(len(response.body) == 0)\n self.assertTrue(len(response.eventSource.raw) == 0)\n\n alpha.close()\n beta.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testNonBlockingRequestStreamFancyJson", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 818 }, { "content": " def testNonBlockingRequestStreamFancyJsonChunked(self):\n \"\"\"\n Test NonBlocking Http client to server Fancy SSE with chunked transfer encoding\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testNonBlockingRequestStreamFancyJsonChunked.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n beta = tcp.Client(ha=alpha.eha, bufsize=131072, wlog=wireLogBeta)\n self.assertIs(beta.reopen(), True)\n self.assertIs(beta.accepted, False)\n self.assertIs(beta.connected, False)\n self.assertIs(beta.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.serviceConnect()\n alpha.serviceConnects()\n if beta.accepted and beta.ca in alpha.ixes:\n break\n time.sleep(0.05)\n\n self.assertIs(beta.accepted, True)\n self.assertIs(beta.connected, True)\n self.assertIs(beta.cutoff, False)\n self.assertEqual(beta.ca, beta.cs.getsockname())\n self.assertEqual(beta.ha, beta.cs.getpeername())\n self.assertEqual(alpha.eha, beta.ha)\n\n ixBeta = alpha.ixes[beta.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.ca)\n self.assertEqual(ixBeta.ha, beta.ha)\n\n console.terse(\"{0}\\n\".format(\"Building Request ...\\n\"))\n host = u'127.0.0.1'\n port = 6061\n method = u'GET'\n path = u'/fancy?idify=true&jsonify=true'\n console.terse(\"{0} from {1}:{2}{3} ...\\n\".format(method, host, port, path))\n headers = odict([(u'Accept', u'application/json')])\n request = clienting.Requester(hostname=host,\n port=port,\n method=method,\n path=path,\n headers=headers)\n msgOut = request.build()\n lines = [\n b'GET /fancy?idify=true&jsonify=true HTTP/1.1',\n b'Host: 127.0.0.1:6061',\n b'Accept-Encoding: identity',\n b'Accept: application/json',\n b'',\n b'',\n ]\n for i, line in enumerate(lines):\n self.assertEqual(line, request.lines[i])\n\n self.assertEqual(request.head, b'GET /fancy?idify=true&jsonify=true HTTP/1.1\\r\\nHost: 127.0.0.1:6061\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n self.assertEqual(msgOut, request.head)\n\n console.terse(\"Beta requests to Alpha\\n\")\n beta.tx(msgOut)\n while beta.txes and not ixBeta.rxbs :\n beta.serviceTxes()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n lines = [\n b'HTTP/1.1 200 OK\\r\\n',\n b'Content-Type: text/event-stream\\r\\n',\n b'Cache-Control: no-cache\\r\\n',\n b'Transfer-Encoding: chunked\\r\\n',\n b'Date: Thu, 30 Apr 2015 22:11:53 GMT\\r\\n',\n b'Server: IoBook.local\\r\\n\\r\\n',\n ]\n\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.rxbs:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceReceives()\n time.sleep(0.05)\n msgIn = bytes(beta.rxbs)\n self.assertEqual(msgIn, msgOut)\n\n console.terse(\"Beta processes response \\n\")\n response = clienting.Respondent(msg=beta.rxbs,\n method=method,\n dictable=True)\n\n lines = [\n b'd\\r\\nretry: 1000\\n\\n\\r\\n',\n b'6\\r\\nid: 0\\n\\r\\n'\n b'd\\r\\ndata: START\\n\\n\\r\\n',\n b'6\\r\\nid: 1\\n\\r\\n',\n b'12\\r\\ndata: {\"count\":1}\\n\\r\\n',\n b'1\\r\\n\\n\\r\\n',\n b'6\\r\\nid: 2\\n\\r\\n12\\r\\ndata: {\"count\":2}\\n\\r\\n1\\r\\n\\n\\r\\n',\n b'6\\r\\nid: 3\\n\\r\\n12\\r\\ndata: {\"count\":3}\\n\\r\\n1\\r\\n\\n\\r\\n',\n b'6\\r\\nid: 4\\n\\r\\n12\\r\\ndata: {\"count\":4}\\n\\r\\n1\\r\\n\\n\\r\\n',\n ]\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n timer = Timer(duration=0.5)\n while response.parser and not timer.expired:\n alpha.serviceTxesAllIx()\n response.parse()\n beta.serviceReceives()\n time.sleep(0.01)\n\n if response.parser:\n response.parser.close()\n response.parser = None\n\n response.dictify()\n\n self.assertEqual(len(beta.rxbs), 0)\n self.assertEqual(response.eventSource.retry, 1000)\n self.assertEqual(response.retry, response.eventSource.retry)\n self.assertTrue(int(response.eventSource.leid) >= 2)\n self.assertEqual(response.leid, response.eventSource.leid)\n self.assertTrue(len(response.events) > 2)\n event = response.events.popleft()\n self.assertEqual(event, {'id': '0', 'name': '', 'data': 'START'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': '1', 'name': '', 'data': {'count': 1}})\n event = response.events.popleft()\n self.assertEqual(event, {'id': '2', 'name': '', 'data': {'count': 2}})\n self.assertTrue(len(response.body) == 0)\n self.assertTrue(len(response.eventSource.raw) == 0)\n\n alpha.close()\n beta.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testNonBlockingRequestStreamFancyJsonChunked", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 974 }, { "content": " def testNonBlockingRequestEchoTLS(self):\n \"\"\"\n Test NonBlocking HTTPS (TLS/SSL) client\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testNonBlockingRequestEchoTLS.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n serverKeypath = '/etc/pki/tls/certs/server_key.pem' # local server private key\n serverCertpath = '/etc/pki/tls/certs/server_cert.pem' # local server public cert\n clientCafilepath = '/etc/pki/tls/certs/client.pem' # remote client public cert\n\n clientKeypath = '/etc/pki/tls/certs/client_key.pem' # local client private key\n clientCertpath = '/etc/pki/tls/certs/client_cert.pem' # local client public cert\n serverCafilepath = '/etc/pki/tls/certs/server.pem' # remote server public cert\n\n alpha = tcp.ServerTls(host='localhost',\n port = 6101,\n bufsize=131072,\n wlog=wireLogAlpha,\n context=None,\n version=None,\n certify=None,\n keypath=serverKeypath,\n certpath=serverCertpath,\n cafilepath=clientCafilepath,\n )\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('127.0.0.1', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n serverCertCommonName = 'localhost' # match hostname uses servers's cert commonname\n\n beta = tcp.ClientTls(ha=alpha.ha,\n bufsize=131072,\n wlog=wireLogBeta,\n context=None,\n version=None,\n certify=None,\n hostify=None,\n certedhost=serverCertCommonName,\n keypath=clientKeypath,\n certpath=clientCertpath,\n cafilepath=serverCafilepath,\n )\n self.assertIs(beta.reopen(), True)\n self.assertIs(beta.accepted, False)\n self.assertIs(beta.connected, False)\n self.assertIs(beta.cutoff, False)\n\n console.terse(\"Connecting and Handshaking beta to alpha\\n\")\n while True:\n beta.serviceConnect()\n alpha.serviceConnects()\n if beta.connected and len(alpha.ixes) >= 1:\n break\n time.sleep(0.01)\n\n self.assertIs(beta.accepted, True)\n self.assertIs(beta.connected, True)\n self.assertIs(beta.cutoff, False)\n self.assertEqual(beta.ca, beta.cs.getsockname())\n self.assertEqual(beta.ha, beta.cs.getpeername())\n self.assertIs(beta.connected, True)\n\n ixBeta = alpha.ixes[beta.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.ca)\n self.assertEqual(ixBeta.ha, beta.ha)\n\n console.terse(\"{0}\\n\".format(\"Building Request ...\\n\"))\n host = u'127.0.0.1'\n port = 6061\n method = u'GET'\n path = u'/echo?name=fame'\n console.terse(\"{0} from {1}:{2}{3} ...\\n\".format(method, host, port, path))\n headers = odict([(u'Accept', u'application/json')])\n request = clienting.Requester(hostname=host,\n port=port,\n method=method,\n path=path,\n headers=headers)\n msgOut = request.build()\n lines = [\n b'GET /echo?name=fame HTTP/1.1',\n b'Host: 127.0.0.1:6061',\n b'Accept-Encoding: identity',\n b'Accept: application/json',\n b'',\n b'',\n ]\n for i, line in enumerate(lines):\n self.assertEqual(line, request.lines[i])\n\n self.assertEqual(request.head, b'GET /echo?name=fame HTTP/1.1\\r\\nHost: 127.0.0.1:6061\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n self.assertEqual(msgOut, b'GET /echo?name=fame HTTP/1.1\\r\\nHost: 127.0.0.1:6061\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n\n console.terse(\"Beta requests to Alpha\\n\")\n beta.tx(msgOut)\n while beta.txes and not ixBeta.rxbs :\n beta.serviceTxes()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n msgOut = b'HTTP/1.1 200 OK\\r\\nContent-Length: 122\\r\\nContent-Type: application/json\\r\\nDate: Thu, 30 Apr 2015 19:37:17 GMT\\r\\nServer: IoBook.local\\r\\n\\r\\n{\"content\": null, \"query\": {\"name\": \"fame\"}, \"verb\": \"GET\", \"url\": \"http://127.0.0.1:8080/echo?name=fame\", \"action\": null}'\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.rxbs:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceReceives()\n time.sleep(0.05)\n msgIn = bytes(beta.rxbs)\n self.assertEqual(msgIn, msgOut)\n\n console.terse(\"Beta processes response \\n\")\n response = clienting.Respondent(msg=beta.rxbs, method=method)\n while response.parser:\n response.parse()\n\n response.dictify()\n\n #self.assertEqual(bytes(response.body), b'{\"content\": null, \"query\": {\"name\": \"fame\"}, \"verb\": \"GET\", \"url\": \"http://127.0.0.1:8080/echo?name=fame\", \"action\": null}')\n self.assertEqual(bytes(response.body), b'')\n self.assertEqual(response.data, {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'}\n )\n self.assertEqual(len(beta.rxbs), 0)\n self.assertEqual(response.headers.items(), [('content-length', '122'),\n ('content-type', 'application/json'),\n ('date', 'Thu, 30 Apr 2015 19:37:17 GMT'),\n ('server', 'IoBook.local')])\n\n alpha.close()\n beta.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testNonBlockingRequestEchoTLS", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1133 }, { "content": " def testPatronRequestEcho(self):\n \"\"\"\n Test Patron request echo non blocking\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testPatronRequestEcho.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n console.terse(\"{0}\\n\".format(\"Building Connector ...\\n\"))\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n host = alpha.eha[0]\n port = alpha.eha[1]\n method = u'GET'\n path = u'/echo?name=fame'\n headers = odict([(u'Accept', u'application/json')])\n\n\n beta = clienting.Patron(bufsize=131072,\n wlog=wireLogBeta,\n hostname=host,\n port=port,\n method=method,\n path=path,\n headers=headers,\n )\n\n self.assertIs(beta.connector.reopen(), True)\n self.assertIs(beta.connector.accepted, False)\n self.assertIs(beta.connector.connected, False)\n self.assertIs(beta.connector.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.connector.serviceConnect()\n alpha.serviceConnects()\n if beta.connector.connected and beta.connector.ca in alpha.ixes:\n break\n time.sleep(0.05)\n\n self.assertIs(beta.connector.accepted, True)\n self.assertIs(beta.connector.connected, True)\n self.assertIs(beta.connector.cutoff, False)\n self.assertEqual(beta.connector.ca, beta.connector.cs.getsockname())\n self.assertEqual(beta.connector.ha, beta.connector.cs.getpeername())\n self.assertEqual(alpha.eha, beta.connector.ha)\n\n ixBeta = alpha.ixes[beta.connector.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.connector.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.connector.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.connector.ca)\n self.assertEqual(ixBeta.ha, beta.connector.ha)\n\n msgOut = beta.requester.build()\n lines = [\n b'GET /echo?name=fame HTTP/1.1',\n b'Host: 127.0.0.1:6101',\n b'Accept-Encoding: identity',\n b'Accept: application/json',\n b'',\n b'',\n ]\n for i, line in enumerate(lines):\n self.assertEqual(line, beta.requester.lines[i])\n\n self.assertEqual(beta.requester.head, b'GET /echo?name=fame HTTP/1.1\\r\\nHost: 127.0.0.1:6101\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n self.assertEqual(msgOut, b'GET /echo?name=fame HTTP/1.1\\r\\nHost: 127.0.0.1:6101\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n\n console.terse(\"Beta requests to Alpha\\n\")\n console.terse(\"{0} from {1}:{2}{3} ...\\n\".format(method, host, port, path))\n beta.connector.tx(msgOut)\n while beta.connector.txes and not ixBeta.rxbs :\n beta.connector.serviceTxes()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n msgOut = b'HTTP/1.1 200 OK\\r\\nContent-Length: 122\\r\\nContent-Type: application/json\\r\\nDate: Thu, 30 Apr 2015 19:37:17 GMT\\r\\nServer: IoBook.local\\r\\n\\r\\n{\"content\": null, \"query\": {\"name\": \"fame\"}, \"verb\": \"GET\", \"url\": \"http://127.0.0.1:8080/echo?name=fame\", \"action\": null}'\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.connector.rxbs:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.connector.serviceReceives()\n time.sleep(0.05)\n msgIn = bytes(beta.connector.rxbs)\n self.assertEqual(msgIn, msgOut)\n\n console.terse(\"Beta processes response \\n\")\n\n while beta.respondent.parser:\n beta.respondent.parse()\n\n beta.respondent.dictify()\n\n self.assertEqual(bytes(beta.respondent.body), b'')\n self.assertEqual(beta.respondent.data, {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'}\n )\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertEqual(beta.respondent.headers.items(), [('content-length', '122'),\n ('content-type', 'application/json'),\n ('date', 'Thu, 30 Apr 2015 19:37:17 GMT'),\n ('server', 'IoBook.local')])\n\n alpha.close()\n beta.connector.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testPatronRequestEcho", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1290 }, { "content": " def testPatronServiceEcho(self):\n \"\"\"\n Test Patron service request response of echo non blocking\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testPatronServiceEcho.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n console.terse(\"{0}\\n\".format(\"Building Connector ...\\n\"))\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n host = alpha.eha[0]\n port = alpha.eha[1]\n method = u'GET'\n path = u'/echo?name=fame'\n headers = odict([(u'Accept', u'application/json')])\n\n\n beta = clienting.Patron(bufsize=131072,\n wlog=wireLogBeta,\n hostname=host,\n port=port,\n method=method,\n path=path,\n headers=headers,\n )\n\n self.assertIs(beta.connector.reopen(), True)\n self.assertIs(beta.connector.accepted, False)\n self.assertIs(beta.connector.connected, False)\n self.assertIs(beta.connector.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.connector.serviceConnect()\n alpha.serviceConnects()\n if beta.connector.connected and beta.connector.ca in alpha.ixes:\n break\n time.sleep(0.05)\n\n self.assertIs(beta.connector.accepted, True)\n self.assertIs(beta.connector.connected, True)\n self.assertIs(beta.connector.cutoff, False)\n self.assertEqual(beta.connector.ca, beta.connector.cs.getsockname())\n self.assertEqual(beta.connector.ha, beta.connector.cs.getpeername())\n self.assertEqual(alpha.eha, beta.connector.ha)\n\n ixBeta = alpha.ixes[beta.connector.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.connector.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.connector.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.connector.ca)\n self.assertEqual(ixBeta.ha, beta.connector.ha)\n\n beta.transmit()\n\n lines = [\n b'GET /echo?name=fame HTTP/1.1',\n b'Host: 127.0.0.1:6101',\n b'Accept-Encoding: identity',\n b'Accept: application/json',\n b'',\n b'',\n ]\n for i, line in enumerate(lines):\n self.assertEqual(line, beta.requester.lines[i])\n\n msgOut = beta.connector.txes[0]\n self.assertEqual(beta.requester.head, b'GET /echo?name=fame HTTP/1.1\\r\\nHost: 127.0.0.1:6101\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n self.assertEqual(msgOut, b'GET /echo?name=fame HTTP/1.1\\r\\nHost: 127.0.0.1:6101\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n\n console.terse(\"Beta requests to Alpha\\n\")\n console.terse(\"{0} from {1}:{2}{3} ...\\n\".format(method, host, port, path))\n\n while beta.connector.txes and not ixBeta.rxbs :\n beta.serviceAll()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n console.terse(\"Beta processes response \\n\")\n msgOut = b'HTTP/1.1 200 OK\\r\\nContent-Length: 122\\r\\nContent-Type: application/json\\r\\nDate: Thu, 30 Apr 2015 19:37:17 GMT\\r\\nServer: IoBook.local\\r\\n\\r\\n{\"content\": null, \"query\": {\"name\": \"fame\"}, \"verb\": \"GET\", \"url\": \"http://127.0.0.1:8080/echo?name=fame\", \"action\": null}'\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.respondent.ended:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n self.assertEqual(len(beta.responses), 1)\n\n self.assertEqual(bytes(beta.respondent.body), b'')\n self.assertEqual(beta.respondent.data, {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'}\n )\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertEqual(beta.respondent.headers.items(), [('content-length', '122'),\n ('content-type', 'application/json'),\n ('date', 'Thu, 30 Apr 2015 19:37:17 GMT'),\n ('server', 'IoBook.local')])\n\n alpha.close()\n beta.connector.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testPatronServiceEcho", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1420 }, { "content": " def testPatronPipelineEcho(self):\n \"\"\"\n Test Patron pipeline servicing\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testPatronPipelineEcho.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n console.terse(\"{0}\\n\".format(\"Building Connector ...\\n\"))\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n host = alpha.eha[0]\n port = alpha.eha[1]\n\n beta = clienting.Patron(bufsize=131072,\n wlog=wireLogBeta,\n hostname=host,\n port=port,\n reconnectable=True,\n )\n\n self.assertIs(beta.connector.reopen(), True)\n self.assertIs(beta.connector.accepted, False)\n self.assertIs(beta.connector.connected, False)\n self.assertIs(beta.connector.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.connector.serviceConnect()\n alpha.serviceConnects()\n if beta.connector.connected and beta.connector.ca in alpha.ixes:\n break\n time.sleep(0.05)\n\n self.assertIs(beta.connector.accepted, True)\n self.assertIs(beta.connector.connected, True)\n self.assertIs(beta.connector.cutoff, False)\n self.assertEqual(beta.connector.ca, beta.connector.cs.getsockname())\n self.assertEqual(beta.connector.ha, beta.connector.cs.getpeername())\n self.assertEqual(alpha.eha, beta.connector.ha)\n\n ixBeta = alpha.ixes[beta.connector.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.connector.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.connector.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.connector.ca)\n self.assertEqual(ixBeta.ha, beta.connector.ha)\n\n request = odict([('method', u'GET'),\n ('path', u'/echo?name=fame'),\n ('qargs', odict()),\n ('fragment', u''),\n ('headers', odict([('Accept', 'application/json')])),\n ('body', None),\n ])\n\n beta.requests.append(request)\n\n console.terse(\"Beta requests to Alpha\\n\")\n console.terse(\"from {0}:{1}, {2} {3} ...\\n\".format(beta.connector.ha[0],\n beta.connector.ha[1],\n request['method'],\n request['path']))\n\n while (beta.requests or beta.connector.txes) and not ixBeta.rxbs :\n beta.serviceAll()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n msgOut = b'GET /echo?name=fame HTTP/1.1\\r\\nHost: 127.0.0.1:6101\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n'\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n console.terse(\"Beta processes response \\n\")\n msgOut = b'HTTP/1.1 200 OK\\r\\nContent-Length: 122\\r\\nContent-Type: application/json\\r\\nDate: Thu, 30 Apr 2015 19:37:17 GMT\\r\\nServer: IoBook.local\\r\\n\\r\\n{\"content\": null, \"query\": {\"name\": \"fame\"}, \"verb\": \"GET\", \"url\": \"http://127.0.0.1:8080/echo?name=fame\", \"action\": null}'\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.respondent.ended:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request':\n {'host': '127.0.0.1',\n 'port': 6101,\n 'scheme': 'http',\n 'method': 'GET',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n }\n })\n\n beta.requests.append(request)\n\n console.terse(\"\\nBeta requests to Alpha again\\n\")\n console.terse(\"from {0}:{1}, {2} {3} ...\\n\".format(beta.connector.ha[0],\n beta.connector.ha[1],\n request['method'],\n request['path']))\n\n while ( beta.requests or beta.connector.txes) and not ixBeta.rxbs :\n beta.serviceAll()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n msgOut = b'GET /echo?name=fame HTTP/1.1\\r\\nHost: 127.0.0.1:6101\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n'\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n console.terse(\"Beta processes response \\n\")\n msgOut = b'HTTP/1.1 200 OK\\r\\nContent-Length: 122\\r\\nContent-Type: application/json\\r\\nDate: Thu, 30 Apr 2015 19:37:17 GMT\\r\\nServer: IoBook.local\\r\\n\\r\\n{\"content\": null, \"query\": {\"name\": \"fame\"}, \"verb\": \"GET\", \"url\": \"http://127.0.0.1:8080/echo?name=fame\", \"action\": null}'\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.respondent.ended:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request': {'host': '127.0.0.1',\n 'port': 6101,\n 'scheme': 'http',\n 'method': 'GET',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers': {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n }\n })\n\n alpha.close()\n beta.connector.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testPatronPipelineEcho", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1549 }, { "content": " def testPatronPipelineEchoSimple(self):\n \"\"\"\n Test Patron pipeline servicing\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testPatronPipelineEchoSimple.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n console.terse(\"{0}\\n\".format(\"Building Connector ...\\n\"))\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n host = alpha.eha[0]\n port = alpha.eha[1]\n\n beta = clienting.Patron(bufsize=131072,\n wlog=wireLogBeta,\n hostname=host,\n port=port,\n reconnectable=True,\n )\n\n self.assertIs(beta.connector.reopen(), True)\n self.assertIs(beta.connector.accepted, False)\n self.assertIs(beta.connector.connected, False)\n self.assertIs(beta.connector.cutoff, False)\n\n request = odict([('method', u'GET'),\n ('path', u'/echo?name=fame'),\n ('qargs', odict()),\n ('fragment', u''),\n ('headers', odict([('Accept', 'application/json')])),\n ('body', None),\n ])\n\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockEchoService(alpha)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request':\n {'host': '127.0.0.1',\n 'port': 6101,\n 'scheme': 'http',\n 'method': 'GET',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n }\n })\n\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockEchoService(alpha)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request':\n {'host': '127.0.0.1',\n 'port': 6101,\n 'scheme': 'http',\n 'method': 'GET',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n }\n })\n\n alpha.close()\n beta.connector.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testPatronPipelineEchoSimple", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1771 }, { "content": " def testPatronPipelineEchoSimplePath(self):\n \"\"\"\n Test Patron pipeline servicing using path components for host port scheme\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testPatronPipelineEchoSimplePath.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n console.terse(\"{0}\\n\".format(\"Building Connector ...\\n\"))\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n #host = alpha.eha[0]\n #port = alpha.eha[1]\n path = \"http://{0}:{1}/\".format('localhost', alpha.eha[1])\n\n beta = clienting.Patron(bufsize=131072,\n wlog=wireLogBeta,\n path=path,\n reconnectable=True,\n )\n\n self.assertIs(beta.connector.reopen(), True)\n self.assertIs(beta.connector.accepted, False)\n self.assertIs(beta.connector.connected, False)\n self.assertIs(beta.connector.cutoff, False)\n\n request = odict([('method', u'GET'),\n ('path', u'/echo?name=fame'),\n ('qargs', odict()),\n ('fragment', u''),\n ('headers', odict([('Accept', 'application/json')])),\n ('body', None),\n ])\n\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockEchoServicePath(alpha)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request':\n {'host': 'localhost',\n 'port': 6101,\n 'scheme': 'http',\n 'method': 'GET',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n }\n })\n\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockEchoServicePath(alpha)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request':\n {'host': 'localhost',\n 'port': 6101,\n 'scheme': 'http',\n 'method': 'GET',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n }\n })\n\n alpha.close()\n beta.connector.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testPatronPipelineEchoSimplePath", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1934 }, { "content": " def testPatronPipelineEchoSimplePathTrack(self):\n \"\"\"\n Test Patron pipeline servicing using path components for host port scheme\n Request includes tracking information that is included in reponses copy\n of request\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testPatronPipelineEchoSimplePathTrack.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n console.terse(\"{0}\\n\".format(\"Building Connector ...\\n\"))\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n #host = alpha.eha[0]\n #port = alpha.eha[1]\n path = \"http://{0}:{1}/\".format('localhost', alpha.eha[1])\n\n beta = clienting.Patron(bufsize=131072,\n wlog=wireLogBeta,\n path=path,\n reconnectable=True,\n )\n\n self.assertIs(beta.connector.reopen(), True)\n self.assertIs(beta.connector.accepted, False)\n self.assertIs(beta.connector.connected, False)\n self.assertIs(beta.connector.cutoff, False)\n\n request = odict([('method', u'GET'),\n ('path', u'/echo?name=fame'),\n ('qargs', odict()),\n ('fragment', u''),\n ('headers', odict([('Accept', 'application/json')])),\n ('body', None),\n ('mid', 1),\n ('drop', '.stuff.reply'),\n ])\n\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockEchoServicePath(alpha)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request':\n {'host': 'localhost',\n 'port': 6101,\n 'scheme': 'http',\n 'method': 'GET',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n 'mid': 1,\n 'drop': '.stuff.reply'\n }\n })\n\n request.update(mid=2, drop='.puff.reply')\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockEchoServicePath(alpha)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request':\n {'host': 'localhost',\n 'port': 6101,\n 'scheme': 'http',\n 'method': 'GET',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n 'mid': 2,\n 'drop': '.puff.reply'\n }\n })\n\n alpha.close()\n beta.connector.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testPatronPipelineEchoSimplePathTrack", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 2079 }, { "content": " def testPatronPipelineEchoJson(self):\n \"\"\"\n Test Patron pipeline servicing using path components for host port scheme\n with json body in data\n Request includes tracking information that is included in reponses copy\n of request\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testPatronPipelineEchoJson.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n console.terse(\"{0}\\n\".format(\"Building Connector ...\\n\"))\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n #host = alpha.eha[0]\n #port = alpha.eha[1]\n path = \"http://{0}:{1}/\".format('localhost', alpha.eha[1])\n\n beta = clienting.Patron(bufsize=131072,\n wlog=wireLogBeta,\n path=path,\n reconnectable=True,\n )\n\n self.assertIs(beta.connector.reopen(), True)\n self.assertIs(beta.connector.accepted, False)\n self.assertIs(beta.connector.connected, False)\n self.assertIs(beta.connector.cutoff, False)\n\n request = odict([('method', u'PUT'),\n ('path', u'/echo?name=fame'),\n ('qargs', odict()),\n ('fragment', u''),\n ('headers', odict([('Accept', 'application/json')])),\n ('data', odict([(\"first\", \"John\"), (\"last\", \"Smith\")])),\n ('mid', 1),\n ('drop', '.stuff.reply'),\n ])\n\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockEchoServiceJson(alpha)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request':\n {'host': 'localhost',\n 'port': 6101,\n 'scheme': 'http',\n 'method': 'PUT',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json',\n 'content-type': 'application/json; charset=utf-8'},\n 'body': b'',\n 'data': { 'first': 'John', 'last': 'Smith'},\n 'fargs': None,\n 'mid': 1,\n 'drop': '.stuff.reply'\n }\n })\n\n request.update(mid=2, drop='.puff.reply')\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockEchoServiceJson(alpha)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request':\n {'host': 'localhost',\n 'port': 6101,\n 'scheme': 'http',\n 'method': 'PUT',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json',\n 'content-type': 'application/json; charset=utf-8'},\n 'body': b'',\n 'data': { 'first': 'John', 'last': 'Smith'},\n 'fargs': None,\n 'mid': 2,\n 'drop': '.puff.reply'\n }\n })\n\n alpha.close()\n beta.connector.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testPatronPipelineEchoJson", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 2252 }, { "content": " def testPatronPipelineStream(self):\n \"\"\"\n Test Patron pipeline stream\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testPatronPipelineStream.__doc__))\n\n\n\n store = storing.Store(stamp=0.0)\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n alpha = tcp.Server(port = 6101,\n bufsize=131072,\n wlog=wireLogAlpha,\n store=store)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n console.terse(\"{0}\\n\".format(\"Building Connector ...\\n\"))\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n host = alpha.eha[0]\n port = alpha.eha[1]\n\n\n beta = clienting.Patron(bufsize=131072,\n wlog=wireLogBeta,\n hostname=host,\n port=port,\n store=store,\n reconnectable=True,\n )\n\n self.assertIs(beta.connector.reopen(), True)\n self.assertIs(beta.connector.accepted, False)\n self.assertIs(beta.connector.connected, False)\n self.assertIs(beta.connector.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.serviceAll()\n alpha.serviceConnects()\n if beta.connector.connected and beta.connector.ca in alpha.ixes:\n break\n time.sleep(0.05)\n beta.connector.store.advanceStamp(0.05)\n\n self.assertIs(beta.connector.accepted, True)\n self.assertIs(beta.connector.connected, True)\n self.assertIs(beta.connector.cutoff, False)\n self.assertEqual(beta.connector.ca, beta.connector.cs.getsockname())\n self.assertEqual(beta.connector.ha, beta.connector.cs.getpeername())\n self.assertEqual(alpha.eha, beta.connector.ha)\n\n ixBeta = alpha.ixes[beta.connector.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.connector.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.connector.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.connector.ca)\n self.assertEqual(ixBeta.ha, beta.connector.ha)\n\n console.terse(\"{0}\\n\".format(\"Building Request ...\\n\"))\n request = odict([('method', u'GET'),\n ('path', u'/stream'),\n ('qargs', odict()),\n ('fragment', u''),\n ('headers', odict([('Accept', 'application/json')])),\n ('body', None),\n ])\n\n beta.requests.append(request)\n\n console.terse(\"Beta requests to Alpha\\n\")\n console.terse(\"from {0}:{1}, {2} {3} ...\\n\".format(beta.connector.ha[0],\n beta.connector.ha[1],\n request['method'],\n request['path']))\n\n while (beta.requests or beta.connector.txes) and not ixBeta.rxbs:\n beta.serviceAll()\n time.sleep(0.05)\n beta.connector.store.advanceStamp(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n beta.connector.store.advanceStamp(0.05)\n\n msgIn = bytes(ixBeta.rxbs)\n msgOut = b'GET /stream HTTP/1.1\\r\\nHost: 127.0.0.1:6101\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n'\n\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n lines = [\n b'HTTP/1.0 200 OK\\r\\n',\n b'Server: PasteWSGIServer/0.5 Python/2.7.9\\r\\n',\n b'Date: Thu, 30 Apr 2015 21:35:25 GMT\\r\\n'\n b'Content-Type: text/event-stream\\r\\n',\n b'Cache-Control: no-cache\\r\\n',\n b'Connection: close\\r\\n\\r\\n',\n b'retry: 1000\\n\\n',\n b'id: 0\\ndata: START\\n\\n',\n b'id: 1\\ndata: 1\\ndata: 2\\n\\n',\n b'id: 2\\ndata: 3\\ndata: 4\\n\\n',\n b'id: 3\\ndata: 5\\ndata: 6\\n\\n',\n b'id: 4\\ndata: 7\\ndata: 8\\n\\n',\n ]\n\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n timer = StoreTimer(store=store, duration=0.5)\n while ixBeta.txes or not timer.expired:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.connector.store.advanceStamp(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n beta.connector.store.advanceStamp(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n\n #timed out while stream still open so no responses in .responses\n self.assertIs(beta.waited, True)\n self.assertIs(beta.respondent.ended, False)\n self.assertEqual(len(beta.responses), 0)\n\n # but are events in .events\n self.assertEqual(len(beta.events), 5)\n self.assertEqual(beta.respondent.retry, 1000)\n self.assertEqual(beta.respondent.leid, '4')\n event = beta.events.popleft()\n self.assertEqual(event, {'id': '0', 'name': '', 'data': 'START'})\n event = beta.events.popleft()\n self.assertEqual(event, {'id': '1', 'name': '', 'data': '1\\n2'})\n event = beta.events.popleft()\n self.assertEqual(event, {'id': '2', 'name': '', 'data': '3\\n4'})\n beta.events.clear()\n\n # alpha's ixBeta connection shutdown prematurely\n console.terse(\"Disconnecting server so beta must auto reconnect ...\\n\")\n alpha.closeIx(beta.connector.ca)\n alpha.removeIx(beta.connector.ca)\n while True:\n beta.serviceAll()\n if not beta.connector.connected:\n break\n time.sleep(0.1)\n beta.connector.store.advanceStamp(0.1)\n\n self.assertIs(beta.connector.cutoff, False)\n\n console.terse(\"Auto reconnecting beta and rerequesting...\\n\")\n while True:\n beta.serviceAll()\n alpha.serviceConnects()\n if beta.connector.connected and beta.connector.ca in alpha.ixes:\n break\n time.sleep(0.05)\n beta.connector.store.advanceStamp(0.05)\n\n self.assertIs(beta.connector.accepted, True)\n self.assertIs(beta.connector.connected, True)\n self.assertIs(beta.connector.cutoff, False)\n self.assertEqual(beta.connector.ca, beta.connector.cs.getsockname())\n self.assertEqual(beta.connector.ha, beta.connector.cs.getpeername())\n self.assertEqual(alpha.eha, beta.connector.ha)\n\n ixBeta = alpha.ixes[beta.connector.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.connector.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.connector.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.connector.ca)\n self.assertEqual(ixBeta.ha, beta.connector.ha)\n\n console.terse(\"Server receiving...\\n\")\n while (beta.requests or beta.connector.txes) or not ixBeta.rxbs:\n beta.serviceAll()\n time.sleep(0.05)\n beta.connector.store.advanceStamp(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n beta.connector.store.advanceStamp(0.05)\n\n msgIn = bytes(ixBeta.rxbs)\n msgOut = b'GET /stream HTTP/1.1\\r\\nHost: 127.0.0.1:6101\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\nLast-Event-Id: 4\\r\\n\\r\\n'\n\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n lines = [\n b'HTTP/1.0 200 OK\\r\\n',\n b'Server: PasteWSGIServer/0.5 Python/2.7.9\\r\\n',\n b'Date: Thu, 30 Apr 2015 21:35:25 GMT\\r\\n'\n b'Content-Type: text/event-stream\\r\\n',\n b'Cache-Control: no-cache\\r\\n',\n b'Connection: close\\r\\n\\r\\n',\n b'id: 5\\ndata: 9\\ndata: 10\\n\\n',\n b'id: 6\\ndata: 11\\ndata: 12\\n\\n',\n ]\n\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n timer = StoreTimer(store=store, duration=0.5)\n while ixBeta.txes or not timer.expired:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.connector.store.advanceStamp(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n beta.connector.store.advanceStamp(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n\n #timed out while stream still open so no responses in .responses\n self.assertIs(beta.waited, True)\n self.assertIs(beta.respondent.ended, False)\n self.assertEqual(len(beta.responses), 0)\n\n # but are events in .events\n self.assertEqual(len(beta.events), 2)\n self.assertEqual(beta.respondent.retry, 1000)\n self.assertEqual(beta.respondent.leid, '6')\n event = beta.events.popleft()\n self.assertEqual(event, {'id': '5', 'name': '', 'data': '9\\n10'})\n event = beta.events.popleft()\n self.assertEqual(event, {'id': '6', 'name': '', 'data': '11\\n12'})\n\n\n alpha.close()\n beta.connector.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testPatronPipelineStream", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 2409 }, { "content": " def testPatronPipelineEchoSimpleSecure(self):\n \"\"\"\n Test Patron pipeline servicing\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testPatronPipelineEchoSimpleSecure.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n serverKeypath = '/etc/pki/tls/certs/server_key.pem' # local server private key\n serverCertpath = '/etc/pki/tls/certs/server_cert.pem' # local server public cert\n clientCafilepath = '/etc/pki/tls/certs/client.pem' # remote client public cert\n\n clientKeypath = '/etc/pki/tls/certs/client_key.pem' # local client private key\n clientCertpath = '/etc/pki/tls/certs/client_cert.pem' # local client public cert\n serverCafilepath = '/etc/pki/tls/certs/server.pem' # remote server public cert\n\n serverCertCommonName = 'localhost' # match hostname uses servers's cert commonname\n\n alpha = tcp.ServerTls(host=serverCertCommonName,\n port = 6101,\n bufsize=131072,\n wlog=wireLogAlpha,\n context=None,\n version=None,\n certify=None,\n keypath=serverKeypath,\n certpath=serverCertpath,\n cafilepath=clientCafilepath,\n )\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('127.0.0.1', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n console.terse(\"{0}\\n\".format(\"Building Patron ...\\n\"))\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n host = alpha.eha[0]\n port = alpha.eha[1]\n\n beta = clienting.Patron(hostname=serverCertCommonName,\n port=alpha.eha[1],\n bufsize=131072,\n wlog=wireLogBeta,\n scheme='https',\n reconnectable=True,\n certedhost=serverCertCommonName,\n keypath=clientKeypath,\n certpath=clientCertpath,\n cafilepath=serverCafilepath,\n )\n\n self.assertIs(beta.connector.reopen(), True)\n self.assertIs(beta.connector.accepted, False)\n self.assertIs(beta.connector.connected, False)\n self.assertIs(beta.connector.cutoff, False)\n\n request = odict([('method', u'GET'),\n ('path', u'/echo?name=fame'),\n ('qargs', odict()),\n ('fragment', u''),\n ('headers', odict([('Accept', 'application/json')])),\n ('body', None),\n ])\n\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockEchoServiceSecure(alpha)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request':\n {'host': 'localhost',\n 'port': 6101,\n 'scheme': 'https',\n 'method': 'GET',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n }\n })\n\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockEchoServiceSecure(alpha)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request':\n {'host': 'localhost',\n 'port': 6101,\n 'scheme': 'https',\n 'method': 'GET',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n }\n })\n\n alpha.close()\n beta.connector.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testPatronPipelineEchoSimpleSecure", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 2670 }, { "content": " def testPatronPipelineEchoSimpleSecurePath(self):\n \"\"\"\n Test Patron pipeline servicing\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testPatronPipelineEchoSimpleSecurePath.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n serverKeypath = '/etc/pki/tls/certs/server_key.pem' # local server private key\n serverCertpath = '/etc/pki/tls/certs/server_cert.pem' # local server public cert\n clientCafilepath = '/etc/pki/tls/certs/client.pem' # remote client public cert\n\n clientKeypath = '/etc/pki/tls/certs/client_key.pem' # local client private key\n clientCertpath = '/etc/pki/tls/certs/client_cert.pem' # local client public cert\n serverCafilepath = '/etc/pki/tls/certs/server.pem' # remote server public cert\n\n serverCertCommonName = 'localhost' # match hostname uses servers's cert commonname\n\n alpha = tcp.ServerTls(host=serverCertCommonName,\n port = 6101,\n bufsize=131072,\n wlog=wireLogAlpha,\n context=None,\n version=None,\n certify=None,\n keypath=serverKeypath,\n certpath=serverCertpath,\n cafilepath=clientCafilepath,\n )\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('127.0.0.1', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n console.terse(\"{0}\\n\".format(\"Building Patron ...\\n\"))\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n #host = alpha.eha[0]\n #port = alpha.eha[1]\n path = \"https://{0}:{1}/\".format(serverCertCommonName, alpha.eha[1])\n\n beta = clienting.Patron(path=path,\n bufsize=131072,\n wlog=wireLogBeta,\n reconnectable=True,\n keypath=clientKeypath,\n certpath=clientCertpath,\n cafilepath=serverCafilepath,\n )\n\n self.assertIs(beta.connector.reopen(), True)\n self.assertIs(beta.connector.accepted, False)\n self.assertIs(beta.connector.connected, False)\n self.assertIs(beta.connector.cutoff, False)\n\n request = odict([('method', u'GET'),\n ('path', u'/echo?name=fame'),\n ('qargs', odict()),\n ('fragment', u''),\n ('headers', odict([('Accept', 'application/json')])),\n ('body', None),\n ])\n\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockEchoServiceSecure(alpha)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request':\n {'host': 'localhost',\n 'port': 6101,\n 'scheme': 'https',\n 'method': 'GET',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n }\n })\n\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockEchoServiceSecure(alpha)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request':\n {'host': 'localhost',\n 'port': 6101,\n 'scheme': 'https',\n 'method': 'GET',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n }\n })\n\n alpha.close()\n beta.connector.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testPatronPipelineEchoSimpleSecurePath", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 2839 }, { "content": " def testPatronRedirectSimple(self):\n \"\"\"\n Test Patron redirect\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testPatronRedirectSimple.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n console.terse(\"{0}\\n\".format(\"Building Connector ...\\n\"))\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n host = alpha.eha[0]\n port = alpha.eha[1]\n\n beta = clienting.Patron(bufsize=131072,\n wlog=wireLogBeta,\n hostname=host,\n port=port,\n reconnectable=True,\n )\n\n self.assertIs(beta.connector.reopen(), True)\n self.assertIs(beta.connector.accepted, False)\n self.assertIs(beta.connector.connected, False)\n self.assertIs(beta.connector.cutoff, False)\n\n request = odict([('method', u'GET'),\n ('path', u'/echo?name=fame'),\n ('qargs', odict()),\n ('fragment', u''),\n ('headers', odict([('Accept', 'application/json')])),\n ('body', None),\n ])\n\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockRedirectService(alpha)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'redirects': [{'body': bytearray(b''),\n 'data': None,\n 'headers': {'access-control-allow-origin': '*',\n 'content-length': '0',\n 'content-type': 'text/plain',\n 'location': 'http://localhost:6101/redirect?name=fame'},\n 'reason': 'Temporary Redirect',\n 'error': None,\n 'errored': False,\n 'request': {'body': b'',\n 'data': None,\n 'fargs': None,\n 'fragment': '',\n 'headers': {'accept': 'application/json'},\n 'host': '127.0.0.1',\n 'method': 'GET',\n 'path': '/echo',\n 'port': 6101,\n 'qargs': {'name': 'fame'},\n 'scheme': 'http'},\n 'status': 307,\n 'version': (1, 1)}],\n 'request':\n {'host': '127.0.0.1',\n 'port': 6101,\n 'scheme': 'http',\n 'method': 'GET',\n 'path': '/redirect',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n }\n })\n\n\n\n alpha.close()\n beta.connector.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testPatronRedirectSimple", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 3032 }, { "content": " def testPatronRedirectComplex(self):\n \"\"\"\n Test Patron redirect\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testPatronRedirectComplex.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n wireLogGamma = wiring.WireLog(buffify=True, same=True)\n result = wireLogGamma.reopen()\n\n gamma = tcp.Server(port = 6103, bufsize=131072, wlog=wireLogGamma)\n self.assertIs(gamma.reopen(), True)\n self.assertEqual(gamma.ha, ('0.0.0.0', 6103))\n self.assertEqual(gamma.eha, ('127.0.0.1', 6103))\n\n console.terse(\"{0}\\n\".format(\"Building Connector ...\\n\"))\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n host = alpha.eha[0]\n port = alpha.eha[1]\n\n beta = clienting.Patron(bufsize=131072,\n wlog=wireLogBeta,\n hostname=host,\n port=port,\n reconnectable=True,\n )\n\n self.assertIs(beta.connector.reopen(), True)\n self.assertIs(beta.connector.accepted, False)\n self.assertIs(beta.connector.connected, False)\n self.assertIs(beta.connector.cutoff, False)\n\n request = odict([('method', u'GET'),\n ('path', u'/echo?name=fame'),\n ('qargs', odict()),\n ('fragment', u''),\n ('headers', odict([('Accept', 'application/json')])),\n ('body', None),\n ])\n\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockRedirectComplexServiceA(alpha)\n self.mockRedirectComplexServiceG(gamma)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'redirects': [{'body': bytearray(b''),\n 'data': None,\n 'headers': {'access-control-allow-origin': '*',\n 'content-length': '0',\n 'content-type': 'text/plain',\n 'location': 'http://localhost:6103/redirect?name=fame'},\n 'reason': 'Temporary Redirect',\n 'error': None,\n 'errored': False,\n 'request': {'body': b'',\n 'data': None,\n 'fargs': None,\n 'fragment': '',\n 'headers': {'accept': 'application/json'},\n 'host': '127.0.0.1',\n 'method': 'GET',\n 'path': '/echo',\n 'port': 6101,\n 'qargs': {'name': 'fame'},\n 'scheme': 'http'},\n 'status': 307,\n 'version': (1, 1)}],\n 'request':\n {'host': 'localhost',\n 'port': 6103,\n 'scheme': 'http',\n 'method': 'GET',\n 'path': '/redirect',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n }\n })\n\n alpha.close()\n gamma.close()\n beta.connector.close()\n\n wireLogAlpha.close()\n wireLogGamma.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testPatronRedirectComplex", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 3194 }, { "content": " def testPatronRedirectComplexSecure(self):\n \"\"\"\n Test Patron redirect\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testPatronRedirectComplexSecure.__doc__))\n\n\n\n serverCertCommonName = 'localhost' # match hostname uses servers's cert commonname\n serverKeypath = '/etc/pki/tls/certs/server_key.pem' # local server private key\n serverCertpath = '/etc/pki/tls/certs/server_cert.pem' # local server public cert\n clientCafilepath = '/etc/pki/tls/certs/client.pem' # remote client public cert\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n alpha = tcp.ServerTls(host=serverCertCommonName,\n port = 6101,\n bufsize=131072,\n wlog=wireLogAlpha,\n context=None,\n version=None,\n certify=None,\n keypath=serverKeypath,\n certpath=serverCertpath,\n cafilepath=clientCafilepath,)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('127.0.0.1', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n wireLogGamma = wiring.WireLog(buffify=True, same=True)\n result = wireLogGamma.reopen()\n\n gamma = tcp.ServerTls(host=serverCertCommonName,\n port = 6103,\n bufsize=131072,\n wlog=wireLogGamma,\n context=None,\n version=None,\n certify=None,\n keypath=serverKeypath,\n certpath=serverCertpath,\n cafilepath=clientCafilepath)\n self.assertIs(gamma.reopen(), True)\n self.assertEqual(gamma.ha, ('127.0.0.1', 6103))\n self.assertEqual(gamma.eha, ('127.0.0.1', 6103))\n\n console.terse(\"{0}\\n\".format(\"Building Connector ...\\n\"))\n\n clientKeypath = '/etc/pki/tls/certs/client_key.pem' # local client private key\n clientCertpath = '/etc/pki/tls/certs/client_cert.pem' # local client public cert\n serverCafilepath = '/etc/pki/tls/certs/server.pem' # remote server public cert\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n host = serverCertCommonName\n port = alpha.eha[1]\n\n beta = clienting.Patron(bufsize=131072,\n wlog=wireLogBeta,\n hostname=host,\n port=port,\n reconnectable=True,\n scheme='https',\n certedhost=serverCertCommonName,\n keypath=clientKeypath,\n certpath=clientCertpath,\n cafilepath=serverCafilepath,)\n\n self.assertIs(beta.connector.reopen(), True)\n self.assertIs(beta.connector.accepted, False)\n self.assertIs(beta.connector.connected, False)\n self.assertIs(beta.connector.cutoff, False)\n\n request = odict([('method', u'GET'),\n ('path', u'/echo?name=fame'),\n ('qargs', odict()),\n ('fragment', u''),\n ('headers', odict([('Accept', 'application/json')])),\n ('body', None),\n ])\n\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockRedirectComplexServiceASecure(alpha)\n self.mockRedirectComplexServiceGSecure(gamma)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'redirects': [{'body': bytearray(b''),\n 'data': None,\n 'headers': {'access-control-allow-origin': '*',\n 'content-length': '0',\n 'content-type': 'text/plain',\n 'location': 'https://localhost:6103/redirect?name=fame'},\n 'reason': 'Temporary Redirect',\n 'error': None,\n 'errored': False,\n 'request': {'body': b'',\n 'data': None,\n 'fargs': None,\n 'fragment': '',\n 'headers': {'accept': 'application/json'},\n 'host': 'localhost',\n 'method': 'GET',\n 'path': '/echo',\n 'port': 6101,\n 'qargs': {'name': 'fame'},\n 'scheme': 'https'},\n 'status': 307,\n 'version': (1, 1)}],\n 'request':\n {'host': 'localhost',\n 'port': 6103,\n 'scheme': 'https',\n 'method': 'GET',\n 'path': '/redirect',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n }\n })\n\n alpha.close()\n gamma.close()\n beta.connector.close()\n\n wireLogAlpha.close()\n wireLogGamma.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testPatronRedirectComplexSecure", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 3364 } ]
[ { "span": "result ", "start_line": 77, "start_column": 8, "end_line": 77, "end_column": 14 }, { "span": "result ", "start_line": 201, "start_column": 8, "end_line": 201, "end_column": 14 }, { "span": "result ", "start_line": 354, "start_column": 8, "end_line": 354, "end_column": 14 }, { "span": "result ", "start_line": 507, "start_column": 8, "end_line": 507, "end_column": 14 }, { "span": "result ", "start_line": 661, "start_column": 8, "end_line": 661, "end_column": 14 }, { "span": "result ", "start_line": 827, "start_column": 8, "end_line": 827, "end_column": 14 }, { "span": "result ", "start_line": 983, "start_column": 8, "end_line": 983, "end_column": 14 }, { "span": "result ", "start_line": 1142, "start_column": 8, "end_line": 1142, "end_column": 14 }, { "span": "result ", "start_line": 1299, "start_column": 8, "end_line": 1299, "end_column": 14 }, { "span": "result ", "start_line": 1429, "start_column": 8, "end_line": 1429, "end_column": 14 }, { "span": "result ", "start_line": 1558, "start_column": 8, "end_line": 1558, "end_column": 14 }, { "span": "result ", "start_line": 1780, "start_column": 8, "end_line": 1780, "end_column": 14 }, { "span": "result ", "start_line": 1943, "start_column": 8, "end_line": 1943, "end_column": 14 }, { "span": "result ", "start_line": 2090, "start_column": 8, "end_line": 2090, "end_column": 14 }, { "span": "result ", "start_line": 2264, "start_column": 8, "end_line": 2264, "end_column": 14 }, { "span": "result ", "start_line": 2420, "start_column": 8, "end_line": 2420, "end_column": 14 }, { "span": "result ", "start_line": 2679, "start_column": 8, "end_line": 2679, "end_column": 14 }, { "span": "result ", "start_line": 2848, "start_column": 8, "end_line": 2848, "end_column": 14 }, { "span": "result ", "start_line": 3041, "start_column": 8, "end_line": 3041, "end_column": 14 }, { "span": "result ", "start_line": 3203, "start_column": 8, "end_line": 3203, "end_column": 14 }, { "span": "result ", "start_line": 3211, "start_column": 8, "end_line": 3211, "end_column": 14 }, { "span": "result ", "start_line": 3378, "start_column": 8, "end_line": 3378, "end_column": 14 }, { "span": "result ", "start_line": 3395, "start_column": 8, "end_line": 3395, "end_column": 14 } ]
[ { "span": "result ", "start_line": 80, "start_column": 8, "end_line": 80, "end_column": 14 }, { "span": "result ", "start_line": 204, "start_column": 8, "end_line": 204, "end_column": 14 }, { "span": "result ", "start_line": 357, "start_column": 8, "end_line": 357, "end_column": 14 }, { "span": "result ", "start_line": 510, "start_column": 8, "end_line": 510, "end_column": 14 }, { "span": "result ", "start_line": 664, "start_column": 8, "end_line": 664, "end_column": 14 }, { "span": "result ", "start_line": 830, "start_column": 8, "end_line": 830, "end_column": 14 }, { "span": "result ", "start_line": 986, "start_column": 8, "end_line": 986, "end_column": 14 }, { "span": "result ", "start_line": 1145, "start_column": 8, "end_line": 1145, "end_column": 14 }, { "span": "result ", "start_line": 1309, "start_column": 8, "end_line": 1309, "end_column": 14 }, { "span": "result ", "start_line": 1439, "start_column": 8, "end_line": 1439, "end_column": 14 }, { "span": "result ", "start_line": 1568, "start_column": 8, "end_line": 1568, "end_column": 14 }, { "span": "result ", "start_line": 1790, "start_column": 8, "end_line": 1790, "end_column": 14 }, { "span": "result ", "start_line": 1953, "start_column": 8, "end_line": 1953, "end_column": 14 }, { "span": "result ", "start_line": 2100, "start_column": 8, "end_line": 2100, "end_column": 14 }, { "span": "result ", "start_line": 2274, "start_column": 8, "end_line": 2274, "end_column": 14 }, { "span": "result ", "start_line": 2433, "start_column": 8, "end_line": 2433, "end_column": 14 }, { "span": "result ", "start_line": 2709, "start_column": 8, "end_line": 2709, "end_column": 14 }, { "span": "result ", "start_line": 2878, "start_column": 8, "end_line": 2878, "end_column": 14 }, { "span": "result ", "start_line": 3051, "start_column": 8, "end_line": 3051, "end_column": 14 }, { "span": "result ", "start_line": 3221, "start_column": 8, "end_line": 3221, "end_column": 14 }, { "span": "result ", "start_line": 3418, "start_column": 8, "end_line": 3418, "end_column": 14 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Non", "Block", "ing", "Request", "Ech", "o_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Non", "Block", "ing", " ", "Http", " ", "client", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Non", "Block", "ing", "Request", "Ech", "o_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "tcp_", "._", "Client_", "(_", "ha_", "=_", "alpha_", "._", "eh", "a_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connected_", "and_", "beta_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ca_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ha_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Request", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "u", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "610", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "u", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}", " ", "from", " ", " ", "{", "1", "}:", "{", "2", "}{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "method_", ",_", "host_", ",_", "port_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "odict_", "(_", "[_", "(_", "u", "'", "Accept", "'_", ",_", "u", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "client", "ing_", "._", "Requeste", "r_", "(_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "request_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", ":", " ", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "request_", "._", "lines_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "request_", "._", "head_", ",_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "Out_", ",_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "beta_", "._", "tx", "es_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Tx", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Length", ":", " ", "122", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "{", "\"", "content", "\":", " ", "null", ",", " ", "\"", "query", "\":", " ", "{", "\"", "name", "\":", " ", "\"", "fam", "e", "\"},", " ", "\"", "verb", "\":", " ", "\"", "GET", "\",", " ", "\"", "url", "\":", " ", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "\",", " ", "\"", "action", "\":", " ", "null", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "beta_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client", "ing_", "._", "Responde", "nt_", "(_", "msg_", "=_", "beta_", "._", "rx", "bs_", ",_", "method_", "=_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "response_", "._", "parser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "._", "dict", "ify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "assert", "Equal", "(", "bytes", "(", "response", ".", "body", "),", " ", "b", "'{", "\"", "content", "\":", " ", "null", ",", " ", "\"", "query", "\":", " ", "{", "\"", "name", "\":", " ", "\"", "fam", "e", "\"},", " ", "\"", "verb", "\":", " ", "\"", "GET", "\",", " ", "\"", "url", "\":", " ", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "\",", " ", "\"", "action", "\":", " ", "null", "}')", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bytes_", "(_", "response_", "._", "body_", ")_", ",_", "b", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "data_", ",_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "headers_", "._", "items_", "(_", ")_", ",_", "[_", "(_", "'", "content", "-", "length", "'_", ",_", "'", "122", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "content", "-", "type", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "date", "'_", ",_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "server", "'_", ",_", "'", "Io", "Boo", "k", ".", "local", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Non", "Block", "ing", "Request", "Stream_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Non", "Block", "ing", " ", "Http", " ", "client", " ", "with", " ", "SSE", " ", "stream", "ing", " ", "server", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Non", "Block", "ing", "Request", "Stream_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "tcp_", "._", "Client_", "(_", "ha_", "=_", "alpha_", "._", "eh", "a_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connected_", "and_", "beta_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ca_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ha_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Request", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "u", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "606", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "u", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "u", "'/", "stream", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}", " ", "from", " ", " ", "{", "1", "}:", "{", "2", "}{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "method_", ",_", "host_", ",_", "port_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "odict_", "(_", "[_", "(_", "u", "'", "Accept", "'_", ",_", "u", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "client", "ing_", "._", "Requeste", "r_", "(_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "request_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "GET", " ", "/", "stream", " ", "HTTP", "/", "1.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", ":", " ", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "request_", "._", "lines_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "request_", "._", "head_", ",_", "b", "'", "GET", " ", "/", "stream", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "Out_", ",_", "request_", "._", "head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "beta_", "._", "tx", "es_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Tx", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "HTTP", "/", "1.0", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Server", ":", " ", "Past", "e", "WS", "GI", "Server", "/", "0.", "5", " ", "Pyth", "on", "/", "2.7", ".9", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "21", ":", "3", "5", ":", "25", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Conten", "t", "-", "Type", ":", " ", "text", "/", "event", "-", "stream", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Cache", "-", "Control", ":", " ", "no", "-", "cache", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Connect", "ion", ":", " ", "close", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "beta_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client", "ing_", "._", "Responde", "nt_", "(_", "msg_", "=_", "beta_", "._", "rx", "bs_", ",_", "method_", "=_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "retr", "y", ":", " ", "1000", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "data", ":", " ", "START", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "data", ":", " ", "1", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "data", ":", " ", "2", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "data", ":", " ", "3", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "data", ":", " ", "4", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "=_", "Timer_", "(_", "duration_", "=_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "response_", "._", "parser_", "and_", "not_", "timer_", "._", "expired_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "parser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "parser_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parser_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "._", "dict", "ify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "event", "Source_", "._", "retry_", ",_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "retry_", ",_", "response_", "._", "event", "Source_", "._", "retry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "event", "Source_", "._", "lei", "d_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "lei", "d_", ",_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "events_", ")_", ">_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "None_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "START", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "None_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "1", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "None_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "2", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "body_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "event", "Source_", "._", "raw_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Non", "Block", "ing", "Request", "Stream", "Chunk", "ed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Non", "Block", "ing", " ", "Http", " ", "client", " ", "with", " ", "SSE", " ", "stream", "ing", " ", "server", " ", "with", " ", "transfer", " ", "encoding", " ", "(", "chunked", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Non", "Block", "ing", "Request", "Stream", "Chunk", "ed_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "tcp_", "._", "Client_", "(_", "ha_", "=_", "alpha_", "._", "eh", "a_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connected_", "and_", "beta_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ca_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ha_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Request", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "u", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "606", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "u", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "u", "'/", "stream", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}", " ", "from", " ", " ", "{", "1", "}:", "{", "2", "}{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "method_", ",_", "host_", ",_", "port_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "odict_", "(_", "[_", "(_", "u", "'", "Accept", "'_", ",_", "u", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "client", "ing_", "._", "Requeste", "r_", "(_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "request_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "GET", " ", "/", "stream", " ", "HTTP", "/", "1.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", ":", " ", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "request_", "._", "lines_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "request_", "._", "head_", ",_", "b", "'", "GET", " ", "/", "stream", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "Out_", ",_", "request_", "._", "head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "beta_", "._", "tx", "es_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Tx", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Conten", "t", "-", "Type", ":", " ", "text", "/", "event", "-", "stream", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Cache", "-", "Control", ":", " ", "no", "-", "cache", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Transfer", "-", "Enco", "ding", ":", " ", "chunked", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "20", ":", "11", ":", "3", "5", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "beta_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client", "ing_", "._", "Responde", "nt_", "(_", "msg_", "=_", "beta_", "._", "rx", "bs_", ",_", "method_", "=_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "d", "\\\\", "r", "\\\\", "nre", "try", ":", " ", "1000", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "d", "\\\\", "r", "\\\\", "ndata", ":", " ", "START", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "9", "\\\\", "r", "\\\\", "ndata", ":", " ", "1", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "9", "\\\\", "r", "\\\\", "ndata", ":", " ", "2", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "9", "\\\\", "r", "\\\\", "ndata", ":", " ", "3", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "9", "\\\\", "r", "\\\\", "ndata", ":", " ", "4", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "=_", "Timer_", "(_", "duration_", "=_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "response_", "._", "parser_", "and_", "not_", "timer_", "._", "expired_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "parser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "parser_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parser_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "._", "dict", "ify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "event", "Source_", "._", "retry_", ",_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "retry_", ",_", "response_", "._", "event", "Source_", "._", "retry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "event", "Source_", "._", "lei", "d_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "lei", "d_", ",_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "events_", ")_", ">_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "None_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "START", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "None_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "1", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "None_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "2", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "body_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "event", "Source_", "._", "raw_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Non", "Block", "ing", "Request", "Stream", "Fan", "cy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Non", "Block", "ing", " ", "Http", " ", "client", " ", "to", " ", "SSE", " ", "server", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Non", "Block", "ing", "Request", "Stream", "Fan", "cy_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "tcp_", "._", "Client_", "(_", "ha_", "=_", "alpha_", "._", "eh", "a_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connected_", "and_", "beta_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ca_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ha_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Request", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "u", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "606", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "u", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "u", "'/", "fancy", "?", "idi", "fy", "=", "true", "&", "multipl", "y", "=", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}", " ", "from", " ", " ", "{", "1", "}:", "{", "2", "}{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "method_", ",_", "host_", ",_", "port_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "odict_", "(_", "[_", "(_", "u", "'", "Accept", "'_", ",_", "u", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "client", "ing_", "._", "Requeste", "r_", "(_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "request_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "GET", " ", "/", "fancy", "?", "idi", "fy", "=", "true", "&", "multipl", "y", "=", "true", " ", "HTTP", "/", "1.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", ":", " ", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "request_", "._", "lines_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "request_", "._", "head_", ",_", "b", "'", "GET", " ", "/", "fancy", "?", "idi", "fy", "=", "true", "&", "multipl", "y", "=", "true", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "Out_", ",_", "request_", "._", "head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "beta_", "._", "tx", "es_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Tx", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "HTTP", "/", "1.0", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Server", ":", " ", "Past", "e", "WS", "GI", "Server", "/", "0.", "5", " ", "Pyth", "on", "/", "2.7", ".9", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "21", ":", "3", "5", ":", "25", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Conten", "t", "-", "Type", ":", " ", "text", "/", "event", "-", "stream", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Cache", "-", "Control", ":", " ", "no", "-", "cache", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Connect", "ion", ":", " ", "close", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "beta_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client", "ing_", "._", "Responde", "nt_", "(_", "msg_", "=_", "beta_", "._", "rx", "bs_", ",_", "method_", "=_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "retr", "y", ":", " ", "1000", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "0", "\\\\", "ndata", ":", " ", "START", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "1", "\\\\", "ndata", ":", " ", "1", "\\\\", "ndata", ":", " ", "2", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "2", "\\\\", "ndata", ":", " ", "3", "\\\\", "ndata", ":", " ", "4", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "3", "\\\\", "ndata", ":", " ", "5", "\\\\", "ndata", ":", " ", "6", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "4", "\\\\", "ndata", ":", " ", "7", "\\\\", "ndata", ":", " ", "8", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "=_", "Timer_", "(_", "duration_", "=_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "response_", "._", "parser_", "and_", "not_", "timer_", "._", "expired_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "parser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "parser_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parser_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "._", "dict", "ify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "event", "Source_", "._", "retry_", ",_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "retry_", ",_", "response_", "._", "event", "Source_", "._", "retry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "int_", "(_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", ">=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "lei", "d_", ",_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "events_", ")_", ">_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "0", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "START", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "1", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "1", "\\\\", "n2", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "2", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "3", "\\\\", "n4", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "body_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "event", "Source_", "._", "raw_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Non", "Block", "ing", "Request", "Stream", "Fan", "cy", "Chunk", "ed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Non", "Block", "ing", " ", "Http", " ", "client", " ", "to", " ", "server", " ", "Fan", "cy", " ", "SSE", " ", "with", " ", "chunked", " ", "transfer", " ", "encoding", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Non", "Block", "ing", "Request", "Stream", "Fan", "cy", "Chunk", "ed_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "tcp_", "._", "Client_", "(_", "ha_", "=_", "alpha_", "._", "eh", "a_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connected_", "and_", "beta_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ca_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ha_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Request", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "u", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "606", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "u", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "u", "'/", "fancy", "?", "idi", "fy", "=", "true", "&", "multipl", "y", "=", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}", " ", "from", " ", " ", "{", "1", "}:", "{", "2", "}{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "method_", ",_", "host_", ",_", "port_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "odict_", "(_", "[_", "(_", "u", "'", "Accept", "'_", ",_", "u", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "client", "ing_", "._", "Requeste", "r_", "(_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "Out_", "=_", "request_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "GET", " ", "/", "fancy", "?", "idi", "fy", "=", "true", "&", "multipl", "y", "=", "true", " ", "HTTP", "/", "1.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", ":", " ", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "request_", "._", "lines_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "request_", "._", "head_", ",_", "b", "'", "GET", " ", "/", "fancy", "?", "idi", "fy", "=", "true", "&", "multipl", "y", "=", "true", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "Out_", ",_", "request_", "._", "head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "beta_", "._", "tx", "es_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Tx", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Conten", "t", "-", "Type", ":", " ", "text", "/", "event", "-", "stream", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Cache", "-", "Control", ":", " ", "no", "-", "cache", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Transfer", "-", "Enco", "ding", ":", " ", "chunked", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "2", "2", ":", "11", ":", "5", "3", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "beta_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client", "ing_", "._", "Responde", "nt_", "(_", "msg_", "=_", "beta_", "._", "rx", "bs_", ",_", "method_", "=_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "d", "\\\\", "r", "\\\\", "nre", "try", ":", " ", "1000", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "0", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "d", "\\\\", "r", "\\\\", "ndata", ":", " ", "START", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "1", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "8", "\\\\", "r", "\\\\", "ndata", ":", " ", "1", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "8", "\\\\", "r", "\\\\", "ndata", ":", " ", "2", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "1", "\\\\", "r", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "2", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "8", "\\\\", "r", "\\\\", "ndata", ":", " ", "3", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "8", "\\\\", "r", "\\\\", "ndata", ":", " ", "4", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "1", "\\\\", "r", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "3", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "8", "\\\\", "r", "\\\\", "ndata", ":", " ", "5", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "8", "\\\\", "r", "\\\\", "ndata", ":", " ", "6", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "1", "\\\\", "r", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "4", "\\\\", "n", "\\\\", "r", "\\\\", "n", "8", "\\\\", "r", "\\\\", "ndata", ":", " ", "7", "\\\\", "n", "\\\\", "r", "\\\\", "n", "8", "\\\\", "r", "\\\\", "ndata", ":", " ", "8", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "1", "\\\\", "r", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "=_", "Timer_", "(_", "duration_", "=_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "response_", "._", "parser_", "and_", "not_", "timer_", "._", "expired_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "parser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "parser_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parser_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "._", "dict", "ify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "event", "Source_", "._", "retry_", ",_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "retry_", ",_", "response_", "._", "event", "Source_", "._", "retry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "int_", "(_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", ">=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "lei", "d_", ",_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "events_", ")_", ">_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "0", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "START", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "1", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "1", "\\\\", "n2", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "2", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "3", "\\\\", "n4", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "body_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "event", "Source_", "._", "raw_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Non", "Block", "ing", "Request", "Stream", "Fan", "cy", "Json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Non", "Block", "ing", " ", "Http", " ", "client", " ", "to", " ", "server", " ", "Fan", "cy", " ", "SSE", " ", "with", " ", "chunked", " ", "transfer", " ", "encoding", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Non", "Block", "ing", "Request", "Stream", "Fan", "cy", "Json_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "tcp_", "._", "Client_", "(_", "ha_", "=_", "alpha_", "._", "eh", "a_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connected_", "and_", "beta_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ca_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ha_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Request", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "u", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "606", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "u", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "u", "'/", "fancy", "?", "idi", "fy", "=", "true", "&", "json", "if", "y", "=", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}", " ", "from", " ", " ", "{", "1", "}:", "{", "2", "}{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "method_", ",_", "host_", ",_", "port_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "odict_", "(_", "[_", "(_", "u", "'", "Accept", "'_", ",_", "u", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "client", "ing_", "._", "Requeste", "r_", "(_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "request_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "GET", " ", "/", "fancy", "?", "idi", "fy", "=", "true", "&", "json", "if", "y", "=", "true", " ", "HTTP", "/", "1.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", ":", " ", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "request_", "._", "lines_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "request_", "._", "head_", ",_", "b", "'", "GET", " ", "/", "fancy", "?", "idi", "fy", "=", "true", "&", "json", "if", "y", "=", "true", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "Out_", ",_", "request_", "._", "head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "beta_", "._", "tx", "es_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Tx", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "HTTP", "/", "1.0", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Server", ":", " ", "Past", "e", "WS", "GI", "Server", "/", "0.", "5", " ", "Pyth", "on", "/", "2.7", ".9", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "21", ":", "3", "5", ":", "25", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Conten", "t", "-", "Type", ":", " ", "text", "/", "event", "-", "stream", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Cache", "-", "Control", ":", " ", "no", "-", "cache", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Connect", "ion", ":", " ", "close", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "beta_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client", "ing_", "._", "Responde", "nt_", "(_", "msg_", "=_", "beta_", "._", "rx", "bs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict", "able_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "retr", "y", ":", " ", "1000", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "0", "\\\\", "ndata", ":", " ", "START", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "1", "\\\\", "ndata", ":", " ", "{", "\"", "count", "\":", "1", "}\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "2", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "data", ":", " ", "{", "\"", "count", "\":", "2", "}\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "3", "\\\\", "ndata", ":", " ", "{", "\"", "count", "\":", "3", "}\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "4", "\\\\", "ndata", ":", " ", "{", "\"", "count", "\":", "4", "}\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "=_", "Timer_", "(_", "duration_", "=_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "response_", "._", "parser_", "and_", "not_", "timer_", "._", "expired_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "parser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "parser_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parser_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "event", "Source_", "._", "retry_", ",_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "retry_", ",_", "response_", "._", "event", "Source_", "._", "retry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "int_", "(_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", ">=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "lei", "d_", ",_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "events_", ")_", ">_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "0", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "START", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "1", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "{_", "'", "count", "'_", ":_", "1_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "2", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "{_", "'", "count", "'_", ":_", "2_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "body_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "event", "Source_", "._", "raw_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Non", "Block", "ing", "Request", "Stream", "Fan", "cy", "Js", "on", "Chunk", "ed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Non", "Block", "ing", " ", "Http", " ", "client", " ", "to", " ", "server", " ", "Fan", "cy", " ", "SSE", " ", "with", " ", "chunked", " ", "transfer", " ", "encoding", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Non", "Block", "ing", "Request", "Stream", "Fan", "cy", "Js", "on", "Chunk", "ed_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "tcp_", "._", "Client_", "(_", "ha_", "=_", "alpha_", "._", "eh", "a_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "accepted_", "and_", "beta_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ca_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ha_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Request", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "u", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "606", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "u", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "u", "'/", "fancy", "?", "idi", "fy", "=", "true", "&", "json", "if", "y", "=", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}", " ", "from", " ", " ", "{", "1", "}:", "{", "2", "}{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "method_", ",_", "host_", ",_", "port_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "odict_", "(_", "[_", "(_", "u", "'", "Accept", "'_", ",_", "u", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "client", "ing_", "._", "Requeste", "r_", "(_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "request_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "GET", " ", "/", "fancy", "?", "idi", "fy", "=", "true", "&", "json", "if", "y", "=", "true", " ", "HTTP", "/", "1.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", ":", " ", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "request_", "._", "lines_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "request_", "._", "head_", ",_", "b", "'", "GET", " ", "/", "fancy", "?", "idi", "fy", "=", "true", "&", "json", "if", "y", "=", "true", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "Out_", ",_", "request_", "._", "head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "beta_", "._", "tx", "es_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Tx", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Conten", "t", "-", "Type", ":", " ", "text", "/", "event", "-", "stream", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Cache", "-", "Control", ":", " ", "no", "-", "cache", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Transfer", "-", "Enco", "ding", ":", " ", "chunked", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "2", "2", ":", "11", ":", "5", "3", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "beta_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client", "ing_", "._", "Responde", "nt_", "(_", "msg_", "=_", "beta_", "._", "rx", "bs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict", "able_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "d", "\\\\", "r", "\\\\", "nre", "try", ":", " ", "1000", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "0", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "d", "\\\\", "r", "\\\\", "ndata", ":", " ", "START", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "1", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "1", "2", "\\\\", "r", "\\\\", "ndata", ":", " ", "{", "\"", "count", "\":", "1", "}\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "1", "\\\\", "r", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "2", "\\\\", "n", "\\\\", "r", "\\\\", "n1", "2", "\\\\", "r", "\\\\", "ndata", ":", " ", "{", "\"", "count", "\":", "2", "}\\\\", "n", "\\\\", "r", "\\\\", "n1", "\\\\", "r", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "3", "\\\\", "n", "\\\\", "r", "\\\\", "n1", "2", "\\\\", "r", "\\\\", "ndata", ":", " ", "{", "\"", "count", "\":", "3", "}\\\\", "n", "\\\\", "r", "\\\\", "n1", "\\\\", "r", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "4", "\\\\", "n", "\\\\", "r", "\\\\", "n1", "2", "\\\\", "r", "\\\\", "ndata", ":", " ", "{", "\"", "count", "\":", "4", "}\\\\", "n", "\\\\", "r", "\\\\", "n1", "\\\\", "r", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "=_", "Timer_", "(_", "duration_", "=_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "response_", "._", "parser_", "and_", "not_", "timer_", "._", "expired_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "parser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "parser_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parser_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "._", "dict", "ify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "event", "Source_", "._", "retry_", ",_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "retry_", ",_", "response_", "._", "event", "Source_", "._", "retry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "int_", "(_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", ">=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "lei", "d_", ",_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "events_", ")_", ">_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "0", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "START", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "1", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "{_", "'", "count", "'_", ":_", "1_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "2", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "{_", "'", "count", "'_", ":_", "2_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "body_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "event", "Source_", "._", "raw_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Non", "Block", "ing", "Request", "Ech", "o", "TLS", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Non", "Block", "ing", " ", "HTTP", "S", " ", "(", "TLS", "/", "SS", "L", ")", " ", "client", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Non", "Block", "ing", "Request", "Ech", "o", "TLS", "_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "server", "Keyp", "ath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "server", "\\u", "key", ".", "pe", "m", "'_", "#", " ", "local", " ", "server", " ", "private", " ", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "Cert", "path_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "server", "\\u", "cert", ".", "pe", "m", "'_", "#", " ", "local", " ", "server", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "Ca", "filepath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "client", ".", "pe", "m", "'_", "#", " ", "remote", " ", "client", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client", "Keyp", "ath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "client", "\\u", "key", ".", "pe", "m", "'_", "#", " ", "local", " ", "client", " ", "private", " ", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "Cert", "path_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "client", "\\u", "cert", ".", "pe", "m", "'_", "#", " ", "local", " ", "client", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "Ca", "filepath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "server", ".", "pe", "m", "'_", "#", " ", "remote", " ", "server", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server", "Tl", "s_", "(_", "host_", "=_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "certi", "fy_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keypa", "th_", "=_", "server", "Keyp", "ath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "path_", "=_", "server", "Cert", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "caf", "ile", "path_", "=_", "client", "Ca", "filepath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "server", "Cert", "Common", "Name_", "=_", "'", "local", "host", "'_", "#", " ", "match", " ", "host", "name", " ", "use", "s", " ", "server", "s", "'", "s", " ", "cert", " ", "common", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "tcp_", "._", "Client", "Tl", "s_", "(_", "ha_", "=_", "alpha_", "._", "ha_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "certi", "fy_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hosti", "fy_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "ed", "host_", "=_", "server", "Cert", "Common", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keypa", "th_", "=_", "client", "Keyp", "ath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "path_", "=_", "client", "Cert", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "caf", "ile", "path_", "=_", "server", "Ca", "filepath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", " ", "and", " ", "Handsha", "king", " ", "beta", " ", "to", " ", "alpha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connected_", "and_", "len_", "(_", "alpha_", "._", "ix", "es_", ")_", ">=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ca_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ha_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Request", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "u", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "606", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "u", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}", " ", "from", " ", " ", "{", "1", "}:", "{", "2", "}{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "method_", ",_", "host_", ",_", "port_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "odict_", "(_", "[_", "(_", "u", "'", "Accept", "'_", ",_", "u", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "client", "ing_", "._", "Requeste", "r_", "(_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "request_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", ":", " ", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "request_", "._", "lines_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "request_", "._", "head_", ",_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "Out_", ",_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "beta_", "._", "tx", "es_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Tx", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Length", ":", " ", "122", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "{", "\"", "content", "\":", " ", "null", ",", " ", "\"", "query", "\":", " ", "{", "\"", "name", "\":", " ", "\"", "fam", "e", "\"},", " ", "\"", "verb", "\":", " ", "\"", "GET", "\",", " ", "\"", "url", "\":", " ", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "\",", " ", "\"", "action", "\":", " ", "null", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "beta_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client", "ing_", "._", "Responde", "nt_", "(_", "msg_", "=_", "beta_", "._", "rx", "bs_", ",_", "method_", "=_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "response_", "._", "parser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "._", "dict", "ify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "assert", "Equal", "(", "bytes", "(", "response", ".", "body", "),", " ", "b", "'{", "\"", "content", "\":", " ", "null", ",", " ", "\"", "query", "\":", " ", "{", "\"", "name", "\":", " ", "\"", "fam", "e", "\"},", " ", "\"", "verb", "\":", " ", "\"", "GET", "\",", " ", "\"", "url", "\":", " ", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "\",", " ", "\"", "action", "\":", " ", "null", "}')", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bytes_", "(_", "response_", "._", "body_", ")_", ",_", "b", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "data_", ",_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "headers_", "._", "items_", "(_", ")_", ",_", "[_", "(_", "'", "content", "-", "length", "'_", ",_", "'", "122", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "content", "-", "type", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "date", "'_", ",_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "server", "'_", ",_", "'", "Io", "Boo", "k", ".", "local", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Patr", "on", "Request", "Ech", "o_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Patr", "on", " ", "request", " ", "echo", " ", "non", " ", "blockin", "g", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Patr", "on", "Request", "Ech", "o_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Connect", "or", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "alpha_", "._", "eh", "a_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "u", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "odict_", "(_", "[_", "(_", "u", "'", "Accept", "'_", ",_", "u", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "client", "ing_", "._", "Patr", "on_", "(_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "connector_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connector_", "._", "connected_", "and_", "beta_", "._", "connector_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "connector_", "._", "ca_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "connector_", "._", "ha_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "connector_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "connector_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "connector_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "connector_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "Out_", "=_", "beta_", "._", "requester_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", ":", " ", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "beta_", "._", "requester_", "._", "lines_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "requester_", "._", "head_", ",_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "Out_", ",_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}", " ", "from", " ", " ", "{", "1", "}:", "{", "2", "}{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "method_", ",_", "host_", ",_", "port_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "beta_", "._", "connector_", "._", "tx", "es_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "connector_", "._", "service", "Tx", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Length", ":", " ", "122", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "{", "\"", "content", "\":", " ", "null", ",", " ", "\"", "query", "\":", " ", "{", "\"", "name", "\":", " ", "\"", "fam", "e", "\"},", " ", "\"", "verb", "\":", " ", "\"", "GET", "\",", " ", "\"", "url", "\":", " ", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "\",", " ", "\"", "action", "\":", " ", "null", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "connector_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "beta_", "._", "respond", "ent_", "._", "parser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "respond", "ent_", "._", "parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "beta_", "._", "respond", "ent_", "._", "dict", "ify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bytes_", "(_", "beta_", "._", "respond", "ent_", "._", "body_", ")_", ",_", "b", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "respond", "ent_", "._", "data_", ",_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "respond", "ent_", "._", "headers_", "._", "items_", "(_", ")_", ",_", "[_", "(_", "'", "content", "-", "length", "'_", ",_", "'", "122", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "content", "-", "type", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "date", "'_", ",_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "server", "'_", ",_", "'", "Io", "Boo", "k", ".", "local", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Patr", "on", "Service", "Ech", "o_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Patr", "on", " ", "service", " ", "request", " ", "response", " ", "of", " ", "echo", " ", "non", " ", "blockin", "g", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Patr", "on", "Service", "Ech", "o_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Connect", "or", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "alpha_", "._", "eh", "a_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "u", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "odict_", "(_", "[_", "(_", "u", "'", "Accept", "'_", ",_", "u", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "client", "ing_", "._", "Patr", "on_", "(_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "connector_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connector_", "._", "connected_", "and_", "beta_", "._", "connector_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "connector_", "._", "ca_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "connector_", "._", "ha_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "connector_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "connector_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "connector_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "connector_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "transmit", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", ":", " ", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "beta_", "._", "requester_", "._", "lines_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "Out_", "=_", "beta_", "._", "connector_", "._", "tx", "es_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "requester_", "._", "head_", ",_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "Out_", ",_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}", " ", "from", " ", " ", "{", "1", "}:", "{", "2", "}{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "method_", ",_", "host_", ",_", "port_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "beta_", "._", "connector_", "._", "tx", "es_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Length", ":", " ", "122", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "{", "\"", "content", "\":", " ", "null", ",", " ", "\"", "query", "\":", " ", "{", "\"", "name", "\":", " ", "\"", "fam", "e", "\"},", " ", "\"", "verb", "\":", " ", "\"", "GET", "\",", " ", "\"", "url", "\":", " ", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "\",", " ", "\"", "action", "\":", " ", "null", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bytes_", "(_", "beta_", "._", "respond", "ent_", "._", "body_", ")_", ",_", "b", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "respond", "ent_", "._", "data_", ",_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "respond", "ent_", "._", "headers_", "._", "items_", "(_", ")_", ",_", "[_", "(_", "'", "content", "-", "length", "'_", ",_", "'", "122", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "content", "-", "type", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "date", "'_", ",_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "server", "'_", ",_", "'", "Io", "Boo", "k", ".", "local", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Patr", "on", "Pipe", "line", "Ech", "o_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Patr", "on", " ", "pipeline", " ", "servic", "ing", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Patr", "on", "Pipe", "line", "Ech", "o_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Connect", "or", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "alpha_", "._", "eh", "a_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "client", "ing_", "._", "Patr", "on_", "(_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reconnect", "able_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "connector_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connector_", "._", "connected_", "and_", "beta_", "._", "connector_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "connector_", "._", "ca_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "connector_", "._", "ha_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "connector_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "connector_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "connector_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "connector_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "odict_", "(_", "[_", "(_", "'", "method", "'_", ",_", "u", "'", "GET", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "path", "'_", ",_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "qa", "rg", "s", "'_", ",_", "odict_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fragment", "'_", ",_", "u", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "header", "s", "'_", ",_", "odict_", "(_", "[_", "(_", "'", "Accept", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "body", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "from", " ", "{", "0", "}:", "{", "1", "},", " ", "{", "2", "}", " ", "{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "beta_", "._", "connector_", "._", "ha_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "ha_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "[_", "'", "method", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "[_", "'", "path", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "beta_", "._", "requests_", "or_", "beta_", "._", "connector_", "._", "tx", "es_", ")_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Length", ":", " ", "122", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "{", "\"", "content", "\":", " ", "null", ",", " ", "\"", "query", "\":", " ", "{", "\"", "name", "\":", " ", "\"", "fam", "e", "\"},", " ", "\"", "verb", "\":", " ", "\"", "GET", "\",", " ", "\"", "url", "\":", " ", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "\",", " ", "\"", "action", "\":", " ", "null", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "127", ".0", ".0", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"\\\\", "n", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", " ", "again", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "from", " ", "{", "0", "}:", "{", "1", "},", " ", "{", "2", "}", " ", "{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "beta_", "._", "connector_", "._", "ha_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "ha_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "[_", "'", "method", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "[_", "'", "path", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "beta_", "._", "requests_", "or_", "beta_", "._", "connector_", "._", "tx", "es_", ")_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Length", ":", " ", "122", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "{", "\"", "content", "\":", " ", "null", ",", " ", "\"", "query", "\":", " ", "{", "\"", "name", "\":", " ", "\"", "fam", "e", "\"},", " ", "\"", "verb", "\":", " ", "\"", "GET", "\",", " ", "\"", "url", "\":", " ", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "\",", " ", "\"", "action", "\":", " ", "null", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "{_", "'", "host", "'_", ":_", "'", "127", ".0", ".0", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Patr", "on", "Pipe", "line", "Ech", "o", "Simple_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Patr", "on", " ", "pipeline", " ", "servic", "ing", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Patr", "on", "Pipe", "line", "Ech", "o", "Simple_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Connect", "or", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "alpha_", "._", "eh", "a_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "client", "ing_", "._", "Patr", "on_", "(_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reconnect", "able_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "odict_", "(_", "[_", "(_", "'", "method", "'_", ",_", "u", "'", "GET", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "path", "'_", ",_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "qa", "rg", "s", "'_", ",_", "odict_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fragment", "'_", ",_", "u", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "header", "s", "'_", ",_", "odict_", "(_", "[_", "(_", "'", "Accept", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "body", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Ech", "o", "Service_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "127", ".0", ".0", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Ech", "o", "Service_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "127", ".0", ".0", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Patr", "on", "Pipe", "line", "Ech", "o", "Simple", "Path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Patr", "on", " ", "pipeline", " ", "servic", "ing", " ", "usi", "ng", " ", "path", " ", "component", "s", " ", "for", " ", "host", " ", "port", " ", "sche", "me", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Patr", "on", "Pipe", "line", "Ech", "o", "Simple", "Path_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Connect", "or", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "host", " ", "=", " ", "alpha", ".", "eh", "a", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", "port", " ", "=", " ", "alpha", ".", "eh", "a", "[", "1", "]_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "\"", "http", "://", "{", "0", "}:", "{", "1", "}/", "\"_", "._", "format_", "(_", "'", "local", "host", "'_", ",_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "client", "ing_", "._", "Patr", "on_", "(_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reconnect", "able_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "odict_", "(_", "[_", "(_", "'", "method", "'_", ",_", "u", "'", "GET", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "path", "'_", ",_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "qa", "rg", "s", "'_", ",_", "odict_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fragment", "'_", ",_", "u", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "header", "s", "'_", ",_", "odict_", "(_", "[_", "(_", "'", "Accept", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "body", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Ech", "o", "Service", "Path_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Ech", "o", "Service", "Path_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Patr", "on", "Pipe", "line", "Ech", "o", "Simple", "Path", "Track_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Patr", "on", " ", "pipeline", " ", "servic", "ing", " ", "usi", "ng", " ", "path", " ", "component", "s", " ", "for", " ", "host", " ", "port", " ", "sche", "me", "\\", "10", ";", " ", " ", " ", " ", "Request", " ", "include", "s", " ", "track", "ing", " ", "informati", "on", " ", "tha", "t", " ", "is", " ", "include", "d", " ", "in", " ", "repon", "ses", " ", "copy", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "request", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Patr", "on", "Pipe", "line", "Ech", "o", "Simple", "Path", "Track_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Connect", "or", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "host", " ", "=", " ", "alpha", ".", "eh", "a", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", "port", " ", "=", " ", "alpha", ".", "eh", "a", "[", "1", "]_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "\"", "http", "://", "{", "0", "}:", "{", "1", "}/", "\"_", "._", "format_", "(_", "'", "local", "host", "'_", ",_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "client", "ing_", "._", "Patr", "on_", "(_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reconnect", "able_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "odict_", "(_", "[_", "(_", "'", "method", "'_", ",_", "u", "'", "GET", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "path", "'_", ",_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "qa", "rg", "s", "'_", ",_", "odict_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fragment", "'_", ",_", "u", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "header", "s", "'_", ",_", "odict_", "(_", "[_", "(_", "'", "Accept", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "body", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "mid", "'_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "drop", "'_", ",_", "'.", "stu", "ff", ".", "repl", "y", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Ech", "o", "Service", "Path_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mid", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "drop", "'_", ":_", "'.", "stu", "ff", ".", "repl", "y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "update_", "(_", "mid_", "=_", "2_", ",_", "drop_", "=_", "'.", "pu", "ff", ".", "repl", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Ech", "o", "Service", "Path_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mid", "'_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "drop", "'_", ":_", "'.", "pu", "ff", ".", "repl", "y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Patr", "on", "Pipe", "line", "Ech", "o", "Json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Patr", "on", " ", "pipeline", " ", "servic", "ing", " ", "usi", "ng", " ", "path", " ", "component", "s", " ", "for", " ", "host", " ", "port", " ", "sche", "me", "\\", "10", ";", " ", " ", " ", " ", "with", " ", "json", " ", "body", " ", "in", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "Request", " ", "include", "s", " ", "track", "ing", " ", "informati", "on", " ", "tha", "t", " ", "is", " ", "include", "d", " ", "in", " ", "repon", "ses", " ", "copy", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "request", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Patr", "on", "Pipe", "line", "Ech", "o", "Json_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Connect", "or", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "host", " ", "=", " ", "alpha", ".", "eh", "a", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", "port", " ", "=", " ", "alpha", ".", "eh", "a", "[", "1", "]_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "\"", "http", "://", "{", "0", "}:", "{", "1", "}/", "\"_", "._", "format_", "(_", "'", "local", "host", "'_", ",_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "client", "ing_", "._", "Patr", "on_", "(_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reconnect", "able_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "odict_", "(_", "[_", "(_", "'", "method", "'_", ",_", "u", "'", "PU", "T", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "path", "'_", ",_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "qa", "rg", "s", "'_", ",_", "odict_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fragment", "'_", ",_", "u", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "header", "s", "'_", ",_", "odict_", "(_", "[_", "(_", "'", "Accept", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "data", "'_", ",_", "odict_", "(_", "[_", "(_", "\"", "first", "\"_", ",_", "\"", "Joh", "n", "\"_", ")_", ",_", "(_", "\"", "last", "\"_", ",_", "\"", "Smi", "th", "\"_", ")_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "mid", "'_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "drop", "'_", ",_", "'.", "stu", "ff", ".", "repl", "y", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Ech", "o", "Service", "Json_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "PU", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", ";", " ", "charset", "=", "utf", "-", "8", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "first", "'_", ":_", "'", "Joh", "n", "'_", ",_", "'", "last", "'_", ":_", "'", "Smi", "th", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mid", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "drop", "'_", ":_", "'.", "stu", "ff", ".", "repl", "y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "update_", "(_", "mid_", "=_", "2_", ",_", "drop_", "=_", "'.", "pu", "ff", ".", "repl", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Ech", "o", "Service", "Json_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "PU", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", ";", " ", "charset", "=", "utf", "-", "8", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "first", "'_", ":_", "'", "Joh", "n", "'_", ",_", "'", "last", "'_", ":_", "'", "Smi", "th", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mid", "'_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "drop", "'_", ":_", "'.", "pu", "ff", ".", "repl", "y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Patr", "on", "Pipe", "line", "Stream_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Patr", "on", " ", "pipeline", " ", "stream", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Patr", "on", "Pipe", "line", "Stream_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "store_", "=_", "stor", "ing_", "._", "Store_", "(_", "stamp_", "=_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "store_", "=_", "store_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Connect", "or", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "alpha_", "._", "eh", "a_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "client", "ing_", "._", "Patr", "on_", "(_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "store_", "=_", "store_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reconnect", "able_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connector_", "._", "connected_", "and_", "beta_", "._", "connector_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "store_", "._", "advance", "Stamp_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "connector_", "._", "ca_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "connector_", "._", "ha_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "connector_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "connector_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "connector_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "connector_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Request", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "odict_", "(_", "[_", "(_", "'", "method", "'_", ",_", "u", "'", "GET", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "path", "'_", ",_", "u", "'/", "stream", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "qa", "rg", "s", "'_", ",_", "odict_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fragment", "'_", ",_", "u", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "header", "s", "'_", ",_", "odict_", "(_", "[_", "(_", "'", "Accept", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "body", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "from", " ", "{", "0", "}:", "{", "1", "},", " ", "{", "2", "}", " ", "{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "beta_", "._", "connector_", "._", "ha_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "ha_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "[_", "'", "method", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "[_", "'", "path", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "beta_", "._", "requests_", "or_", "beta_", "._", "connector_", "._", "tx", "es_", ")_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "store_", "._", "advance", "Stamp_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "store_", "._", "advance", "Stamp_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "GET", " ", "/", "stream", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "HTTP", "/", "1.0", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Server", ":", " ", "Past", "e", "WS", "GI", "Server", "/", "0.", "5", " ", "Pyth", "on", "/", "2.7", ".9", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "21", ":", "3", "5", ":", "25", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Conten", "t", "-", "Type", ":", " ", "text", "/", "event", "-", "stream", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Cache", "-", "Control", ":", " ", "no", "-", "cache", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Connect", "ion", ":", " ", "close", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "retr", "y", ":", " ", "1000", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "0", "\\\\", "ndata", ":", " ", "START", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "1", "\\\\", "ndata", ":", " ", "1", "\\\\", "ndata", ":", " ", "2", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "2", "\\\\", "ndata", ":", " ", "3", "\\\\", "ndata", ":", " ", "4", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "3", "\\\\", "ndata", ":", " ", "5", "\\\\", "ndata", ":", " ", "6", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "4", "\\\\", "ndata", ":", " ", "7", "\\\\", "ndata", ":", " ", "8", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "=_", "Stor", "e", "Timer_", "(_", "store_", "=_", "store_", ",_", "duration_", "=_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "timer_", "._", "expired_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "store_", "._", "advance", "Stamp_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "store_", "._", "advance", "Stamp_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "timed", " ", "out", " ", "whi", "le", " ", "stream", " ", "still", " ", "open", " ", "so", " ", "no", " ", "response", "s", " ", "in", " ", ".", "responses_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "are", " ", "events", " ", "in", " ", ".", "events_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "events_", ")_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "respond", "ent_", "._", "retry_", ",_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "respond", "ent_", "._", "lei", "d_", ",_", "'", "4", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "beta_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "0", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "START", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "beta_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "1", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "1", "\\\\", "n2", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "beta_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "2", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "3", "\\\\", "n4", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "events_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "alpha", "'", "s", " ", "ix", "Beta", " ", "connecti", "on", " ", "shut", "down", " ", "prem", "ature", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Disconnect", "ing", " ", "server", " ", "so", " ", "beta", " ", "must", " ", "auto", " ", "reconnect", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "close", "Ix", "_", "(_", "beta_", "._", "connector_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "remove", "Ix", "_", "(_", "beta_", "._", "connector_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "beta_", "._", "connector_", "._", "connected_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "store_", "._", "advance", "Stamp_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Auto", " ", "reconnect", "ing", " ", "beta", " ", "and", " ", "rer", "eque", "stin", "g", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connector_", "._", "connected_", "and_", "beta_", "._", "connector_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "store_", "._", "advance", "Stamp_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "connector_", "._", "ca_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "connector_", "._", "ha_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "connector_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "connector_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "connector_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "connector_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Server", " ", "receiv", "ing", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "(_", "beta_", "._", "requests_", "or_", "beta_", "._", "connector_", "._", "tx", "es_", ")_", "or_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "store_", "._", "advance", "Stamp_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "store_", "._", "advance", "Stamp_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "GET", " ", "/", "stream", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "Las", "t", "-", "Event", "-", "Id", ":", " ", "4", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "HTTP", "/", "1.0", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Server", ":", " ", "Past", "e", "WS", "GI", "Server", "/", "0.", "5", " ", "Pyth", "on", "/", "2.7", ".9", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "21", ":", "3", "5", ":", "25", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Conten", "t", "-", "Type", ":", " ", "text", "/", "event", "-", "stream", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Cache", "-", "Control", ":", " ", "no", "-", "cache", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Connect", "ion", ":", " ", "close", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "5", "\\\\", "ndata", ":", " ", "9", "\\\\", "ndata", ":", " ", "10", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "6", "\\\\", "ndata", ":", " ", "11", "\\\\", "ndata", ":", " ", "1", "2", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "=_", "Stor", "e", "Timer_", "(_", "store_", "=_", "store_", ",_", "duration_", "=_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "timer_", "._", "expired_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "store_", "._", "advance", "Stamp_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "store_", "._", "advance", "Stamp_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "timed", " ", "out", " ", "whi", "le", " ", "stream", " ", "still", " ", "open", " ", "so", " ", "no", " ", "response", "s", " ", "in", " ", ".", "responses_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "are", " ", "events", " ", "in", " ", ".", "events_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "events_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "respond", "ent_", "._", "retry_", ",_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "respond", "ent_", "._", "lei", "d_", ",_", "'", "6", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "beta_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "5", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "9", "\\\\", "n1", "0", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "beta_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "6", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "11", "\\\\", "n1", "2", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Patr", "on", "Pipe", "line", "Ech", "o", "Simple", "Secur", "e_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Patr", "on", " ", "pipeline", " ", "servic", "ing", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Patr", "on", "Pipe", "line", "Ech", "o", "Simple", "Secur", "e_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "server", "Keyp", "ath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "server", "\\u", "key", ".", "pe", "m", "'_", "#", " ", "local", " ", "server", " ", "private", " ", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "Cert", "path_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "server", "\\u", "cert", ".", "pe", "m", "'_", "#", " ", "local", " ", "server", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "Ca", "filepath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "client", ".", "pe", "m", "'_", "#", " ", "remote", " ", "client", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client", "Keyp", "ath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "client", "\\u", "key", ".", "pe", "m", "'_", "#", " ", "local", " ", "client", " ", "private", " ", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "Cert", "path_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "client", "\\u", "cert", ".", "pe", "m", "'_", "#", " ", "local", " ", "client", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "Ca", "filepath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "server", ".", "pe", "m", "'_", "#", " ", "remote", " ", "server", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "server", "Cert", "Common", "Name_", "=_", "'", "local", "host", "'_", "#", " ", "match", " ", "host", "name", " ", "use", "s", " ", "server", "s", "'", "s", " ", "cert", " ", "common", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server", "Tl", "s_", "(_", "host_", "=_", "server", "Cert", "Common", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "certi", "fy_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keypa", "th_", "=_", "server", "Keyp", "ath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "path_", "=_", "server", "Cert", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "caf", "ile", "path_", "=_", "client", "Ca", "filepath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Patr", "on", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "alpha_", "._", "eh", "a_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "client", "ing_", "._", "Patr", "on_", "(_", "hostname_", "=_", "server", "Cert", "Common", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scheme_", "=_", "'", "https", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reconnect", "able_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "ed", "host_", "=_", "server", "Cert", "Common", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keypa", "th_", "=_", "client", "Keyp", "ath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "path_", "=_", "client", "Cert", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "caf", "ile", "path_", "=_", "server", "Ca", "filepath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "odict_", "(_", "[_", "(_", "'", "method", "'_", ",_", "u", "'", "GET", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "path", "'_", ",_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "qa", "rg", "s", "'_", ",_", "odict_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fragment", "'_", ",_", "u", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "header", "s", "'_", ",_", "odict_", "(_", "[_", "(_", "'", "Accept", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "body", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Ech", "o", "Service", "Secur", "e_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "https", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Ech", "o", "Service", "Secur", "e_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "https", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Patr", "on", "Pipe", "line", "Ech", "o", "Simple", "Secur", "e", "Path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Patr", "on", " ", "pipeline", " ", "servic", "ing", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Patr", "on", "Pipe", "line", "Ech", "o", "Simple", "Secur", "e", "Path_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "server", "Keyp", "ath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "server", "\\u", "key", ".", "pe", "m", "'_", "#", " ", "local", " ", "server", " ", "private", " ", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "Cert", "path_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "server", "\\u", "cert", ".", "pe", "m", "'_", "#", " ", "local", " ", "server", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "Ca", "filepath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "client", ".", "pe", "m", "'_", "#", " ", "remote", " ", "client", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client", "Keyp", "ath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "client", "\\u", "key", ".", "pe", "m", "'_", "#", " ", "local", " ", "client", " ", "private", " ", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "Cert", "path_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "client", "\\u", "cert", ".", "pe", "m", "'_", "#", " ", "local", " ", "client", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "Ca", "filepath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "server", ".", "pe", "m", "'_", "#", " ", "remote", " ", "server", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "server", "Cert", "Common", "Name_", "=_", "'", "local", "host", "'_", "#", " ", "match", " ", "host", "name", " ", "use", "s", " ", "server", "s", "'", "s", " ", "cert", " ", "common", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server", "Tl", "s_", "(_", "host_", "=_", "server", "Cert", "Common", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "certi", "fy_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keypa", "th_", "=_", "server", "Keyp", "ath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "path_", "=_", "server", "Cert", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "caf", "ile", "path_", "=_", "client", "Ca", "filepath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Patr", "on", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "host", " ", "=", " ", "alpha", ".", "eh", "a", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", "port", " ", "=", " ", "alpha", ".", "eh", "a", "[", "1", "]_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "\"", "https", "://", "{", "0", "}:", "{", "1", "}/", "\"_", "._", "format_", "(_", "server", "Cert", "Common", "Name_", ",_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "client", "ing_", "._", "Patr", "on_", "(_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reconnect", "able_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keypa", "th_", "=_", "client", "Keyp", "ath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "path_", "=_", "client", "Cert", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "caf", "ile", "path_", "=_", "server", "Ca", "filepath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "odict_", "(_", "[_", "(_", "'", "method", "'_", ",_", "u", "'", "GET", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "path", "'_", ",_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "qa", "rg", "s", "'_", ",_", "odict_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fragment", "'_", ",_", "u", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "header", "s", "'_", ",_", "odict_", "(_", "[_", "(_", "'", "Accept", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "body", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Ech", "o", "Service", "Secur", "e_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "https", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Ech", "o", "Service", "Secur", "e_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "https", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Patr", "on", "Redirect", "Simple_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Patr", "on", " ", "redirec", "t", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Patr", "on", "Redirect", "Simple_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Connect", "or", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "alpha_", "._", "eh", "a_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "client", "ing_", "._", "Patr", "on_", "(_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reconnect", "able_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "odict_", "(_", "[_", "(_", "'", "method", "'_", ",_", "u", "'", "GET", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "path", "'_", ",_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "qa", "rg", "s", "'_", ",_", "odict_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fragment", "'_", ",_", "u", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "header", "s", "'_", ",_", "odict_", "(_", "[_", "(_", "'", "Accept", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "body", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Redirect", "Service_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "redirec", "ts", "'_", ":_", "[_", "{_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "{_", "'", "access", "-", "control", "-", "allow", "-", "orig", "in", "'_", ":_", "'*'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "length", "'_", ":_", "'", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "text", "/", "plain", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "location", "'_", ":_", "'", "http", "://", "local", "host", ":", "610", "1", "/", "redirec", "t", "?", "name", "=", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "Tempora", "ry", " ", "Redirect", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "{_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "host", "'_", ":_", "'", "127", ".0", ".0", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "307", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "127", ".0", ".0", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "redirec", "t", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Patr", "on", "Redirect", "Complex_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Patr", "on", " ", "redirec", "t", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Patr", "on", "Redirect", "Complex_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Gamma", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Gamma", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gamma_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "3_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Gamma", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "gamma_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gamma_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gamma_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Connect", "or", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "alpha_", "._", "eh", "a_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "client", "ing_", "._", "Patr", "on_", "(_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reconnect", "able_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "odict_", "(_", "[_", "(_", "'", "method", "'_", ",_", "u", "'", "GET", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "path", "'_", ",_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "qa", "rg", "s", "'_", ",_", "odict_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fragment", "'_", ",_", "u", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "header", "s", "'_", ",_", "odict_", "(_", "[_", "(_", "'", "Accept", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "body", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Redirect", "Comple", "x", "Service", "A_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mock", "Redirect", "Comple", "x", "Service", "G_", "(_", "gamma_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "redirec", "ts", "'_", ":_", "[_", "{_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "{_", "'", "access", "-", "control", "-", "allow", "-", "orig", "in", "'_", ":_", "'*'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "length", "'_", ":_", "'", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "text", "/", "plain", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "location", "'_", ":_", "'", "http", "://", "local", "host", ":", "610", "3", "/", "redirec", "t", "?", "name", "=", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "Tempora", "ry", " ", "Redirect", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "{_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "host", "'_", ":_", "'", "127", ".0", ".0", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "307", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "redirec", "t", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gamma_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Gamma", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Patr", "on", "Redirect", "Comple", "x", "Secur", "e_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Patr", "on", " ", "redirec", "t", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Patr", "on", "Redirect", "Comple", "x", "Secur", "e_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "server", "Cert", "Common", "Name_", "=_", "'", "local", "host", "'_", "#", " ", "match", " ", "host", "name", " ", "use", "s", " ", "server", "s", "'", "s", " ", "cert", " ", "common", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "Keyp", "ath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "server", "\\u", "key", ".", "pe", "m", "'_", "#", " ", "local", " ", "server", " ", "private", " ", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "Cert", "path_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "server", "\\u", "cert", ".", "pe", "m", "'_", "#", " ", "local", " ", "server", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "Ca", "filepath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "client", ".", "pe", "m", "'_", "#", " ", "remote", " ", "client", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server", "Tl", "s_", "(_", "host_", "=_", "server", "Cert", "Common", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "certi", "fy_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keypa", "th_", "=_", "server", "Keyp", "ath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "path_", "=_", "server", "Cert", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "caf", "ile", "path_", "=_", "client", "Ca", "filepath_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Gamma", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Gamma", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gamma_", "=_", "tcp_", "._", "Server", "Tl", "s_", "(_", "host_", "=_", "server", "Cert", "Common", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "610", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Gamma", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "certi", "fy_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keypa", "th_", "=_", "server", "Keyp", "ath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "path_", "=_", "server", "Cert", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "caf", "ile", "path_", "=_", "client", "Ca", "filepath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "gamma_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gamma_", "._", "ha_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gamma_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Connect", "or", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client", "Keyp", "ath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "client", "\\u", "key", ".", "pe", "m", "'_", "#", " ", "local", " ", "client", " ", "private", " ", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "Cert", "path_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "client", "\\u", "cert", ".", "pe", "m", "'_", "#", " ", "local", " ", "client", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "Ca", "filepath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "server", ".", "pe", "m", "'_", "#", " ", "remote", " ", "server", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "server", "Cert", "Common", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "client", "ing_", "._", "Patr", "on_", "(_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reconnect", "able_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scheme_", "=_", "'", "https", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "ed", "host_", "=_", "server", "Cert", "Common", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keypa", "th_", "=_", "client", "Keyp", "ath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "path_", "=_", "client", "Cert", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "caf", "ile", "path_", "=_", "server", "Ca", "filepath_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "odict_", "(_", "[_", "(_", "'", "method", "'_", ",_", "u", "'", "GET", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "path", "'_", ",_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "qa", "rg", "s", "'_", ",_", "odict_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fragment", "'_", ",_", "u", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "header", "s", "'_", ",_", "odict_", "(_", "[_", "(_", "'", "Accept", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "body", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Redirect", "Comple", "x", "Service", "AS", "ecu", "re_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mock", "Redirect", "Comple", "x", "Service", "GS", "ecu", "re_", "(_", "gamma_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "redirec", "ts", "'_", ":_", "[_", "{_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "{_", "'", "access", "-", "control", "-", "allow", "-", "orig", "in", "'_", ":_", "'*'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "length", "'_", ":_", "'", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "text", "/", "plain", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "location", "'_", ":_", "'", "https", "://", "local", "host", ":", "610", "3", "/", "redirec", "t", "?", "name", "=", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "Tempora", "ry", " ", "Redirect", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "{_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "host", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "https", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "307", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "https", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "redirec", "t", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gamma_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Gamma", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ReactiveX/RxPY/tests/test_observable/test_merge.py
[ { "content": "import unittest\n\nfrom rx import Observable\nfrom rx.testing import TestScheduler, ReactiveTest, is_prime, MockDisposable\nfrom rx.disposables import Disposable, SerialDisposable\n\non_next = ReactiveTest.on_next\non_completed = ReactiveTest.on_completed\non_error = ReactiveTest.on_error\nsubscribe = ReactiveTest.subscribe\nsubscribed = ReactiveTest.subscribed\ndisposed = ReactiveTest.disposed\ncreated = ReactiveTest.created\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestMerge(unittest.TestCase):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.TestMerge", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def test_merge_never2(self):\n scheduler = TestScheduler()\n n1 = Observable.never()\n n2 = Observable.never()\n\n def create():\n return Observable.merge(scheduler, n1, n2)\n\n results = scheduler.start(create)\n results.messages.assert_equal()", "metadata": "root.TestMerge.test_merge_never2", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 15 }, { "content": " def test_merge_never3(self):\n scheduler = TestScheduler()\n n1 = Observable.never()\n n2 = Observable.never()\n n3 = Observable.never()\n\n def create():\n return Observable.merge(scheduler, n1, n2, n3)\n\n results = scheduler.start(create)\n results.messages.assert_equal()", "metadata": "root.TestMerge.test_merge_never3", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 26 }, { "content": " def test_merge_empty2(self):\n scheduler = TestScheduler()\n e1 = Observable.empty()\n e2 = Observable.empty()\n\n def create():\n return Observable.merge(scheduler, e1, e2)\n\n results = scheduler.start(create)\n results.messages.assert_equal(on_completed(203))", "metadata": "root.TestMerge.test_merge_empty2", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 38 }, { "content": " def test_merge_empty3(self):\n scheduler = TestScheduler()\n e1 = Observable.empty()\n e2 = Observable.empty()\n e3 = Observable.empty()\n\n def create():\n return Observable.merge(scheduler, e1, e2, e3)\n\n results = scheduler.start(create)\n results.messages.assert_equal(on_completed(204))", "metadata": "root.TestMerge.test_merge_empty3", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 49 }, { "content": " def test_merge_empty_delayed2_right_last(self):\n scheduler = TestScheduler()\n l_msgs = [on_next(150, 1), on_completed(240)]\n r_msgs = [on_next(150, 1), on_completed(250)]\n e1 = scheduler.create_hot_observable(l_msgs)\n e2 = scheduler.create_hot_observable(r_msgs)\n\n def create():\n return Observable.merge(scheduler, e1, e2)\n\n results = scheduler.start(create)\n results.messages.assert_equal(on_completed(250))", "metadata": "root.TestMerge.test_merge_empty_delayed2_right_last", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 61 }, { "content": " def test_merge_empty_delayed2_left_last(self):\n scheduler = TestScheduler()\n l_msgs = [on_next(150, 1), on_completed(250)]\n r_msgs = [on_next(150, 1), on_completed(240)]\n e1 = scheduler.create_hot_observable(l_msgs)\n e2 = scheduler.create_hot_observable(r_msgs)\n\n def create():\n return Observable.merge(scheduler, e1, e2)\n results = scheduler.start(create)\n results.messages.assert_equal(on_completed(250))", "metadata": "root.TestMerge.test_merge_empty_delayed2_left_last", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 74 }, { "content": " def test_merge_empty_delayed3_middle_last(self):\n scheduler = TestScheduler()\n msgs1 = [on_next(150, 1), on_completed(245)]\n msgs2 = [on_next(150, 1), on_completed(250)]\n msgs3 = [on_next(150, 1), on_completed(240)]\n e1 = scheduler.create_hot_observable(msgs1)\n e2 = scheduler.create_hot_observable(msgs2)\n e3 = scheduler.create_hot_observable(msgs3)\n\n def create():\n return Observable.merge(scheduler, e1, e2, e3)\n\n results = scheduler.start(create)\n results.messages.assert_equal(on_completed(250))", "metadata": "root.TestMerge.test_merge_empty_delayed3_middle_last", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 86 }, { "content": " def test_merge_empty_never(self):\n scheduler = TestScheduler()\n msgs1 = [on_next(150, 1), on_completed(245)]\n e1 = scheduler.create_hot_observable(msgs1)\n n1 = Observable.never()\n\n def create():\n return Observable.merge(scheduler, e1, n1)\n\n results = scheduler.start(create)\n results.messages.assert_equal()", "metadata": "root.TestMerge.test_merge_empty_never", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 101 }, { "content": " def test_merge_never_empty(self):\n scheduler = TestScheduler()\n msgs1 = [on_next(150, 1), on_completed(245)]\n e1 = scheduler.create_hot_observable(msgs1)\n n1 = Observable.never()\n\n def create():\n return Observable.merge(scheduler, n1, e1)\n\n results = scheduler.start(create)\n results.messages.assert_equal()", "metadata": "root.TestMerge.test_merge_never_empty", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 113 }, { "content": " def test_merge_return_never(self):\n scheduler = TestScheduler()\n msgs1 = [on_next(150, 1), on_next(210, 2), on_completed(245)]\n r1 = scheduler.create_hot_observable(msgs1)\n n1 = Observable.never()\n\n def create():\n return Observable.merge(scheduler, r1, n1)\n\n results = scheduler.start(create)\n results.messages.assert_equal(on_next(210, 2))", "metadata": "root.TestMerge.test_merge_return_never", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 125 }, { "content": " def test_merge_never_return(self):\n scheduler = TestScheduler()\n msgs1 = [on_next(150, 1), on_next(210, 2), on_completed(245)]\n r1 = scheduler.create_hot_observable(msgs1)\n n1 = Observable.never()\n\n def create():\n return Observable.merge(scheduler, n1, r1)\n\n results = scheduler.start(create)\n results.messages.assert_equal(on_next(210, 2))", "metadata": "root.TestMerge.test_merge_never_return", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 137 }, { "content": " def test_merge_error_never(self):\n ex = 'ex'\n scheduler = TestScheduler()\n msgs1 = [on_next(150, 1), on_next(210, 2), on_error(245, ex)]\n e1 = scheduler.create_hot_observable(msgs1)\n n1 = Observable.never()\n\n def create():\n return Observable.merge(scheduler, e1, n1)\n\n results = scheduler.start(create)\n results.messages.assert_equal(on_next(210, 2), on_error(245, ex))", "metadata": "root.TestMerge.test_merge_error_never", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 149 }, { "content": " def test_merge_never_error(self):\n ex = 'ex'\n scheduler = TestScheduler()\n msgs1 = [on_next(150, 1), on_next(210, 2), on_error(245, ex)]\n e1 = scheduler.create_hot_observable(msgs1)\n n1 = Observable.never()\n\n def create():\n return Observable.merge(scheduler, n1, e1)\n\n results = scheduler.start(create)\n results.messages.assert_equal(on_next(210, 2), on_error(245, ex))", "metadata": "root.TestMerge.test_merge_never_error", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 162 }, { "content": " def test_merge_empty_return(self):\n scheduler = TestScheduler()\n msgs1 = [on_next(150, 1), on_completed(245)]\n msgs2 = [on_next(150, 1), on_next(210, 2), on_completed(250)]\n e1 = scheduler.create_hot_observable(msgs1)\n r1 = scheduler.create_hot_observable(msgs2)\n\n def create():\n return Observable.merge(scheduler, e1, r1)\n\n results = scheduler.start(create)\n results.messages.assert_equal(on_next(210, 2), on_completed(250))", "metadata": "root.TestMerge.test_merge_empty_return", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 175 }, { "content": " def test_merge_return_empty(self):\n scheduler = TestScheduler()\n msgs1 = [on_next(150, 1), on_completed(245)]\n msgs2 = [on_next(150, 1), on_next(210, 2), on_completed(250)]\n e1 = scheduler.create_hot_observable(msgs1)\n r1 = scheduler.create_hot_observable(msgs2)\n\n def create():\n return Observable.merge(scheduler, r1, e1)\n\n results = scheduler.start(create)\n results.messages.assert_equal(on_next(210, 2), on_completed(250))", "metadata": "root.TestMerge.test_merge_return_empty", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 188 }, { "content": " def test_merge_lots2(self):\n scheduler = TestScheduler()\n msgs1 = [on_next(150, 1), on_next(210, 2), on_next(220, 4), on_next(230, 6), on_next(240, 8), on_completed(245)]\n msgs2 = [on_next(150, 1), on_next(215, 3), on_next(225, 5), on_next(235, 7), on_next(245, 9), on_completed(250)]\n o1 = scheduler.create_hot_observable(msgs1)\n o2 = scheduler.create_hot_observable(msgs2)\n\n def create():\n return Observable.merge(scheduler, o1, o2)\n\n results = scheduler.start(create).messages\n assert(len(results) == 9)\n for i, result in enumerate(results[:-1]):\n assert(result.value.kind == 'N')\n assert(result.time == 210 + i * 5)\n assert(result.value.value == i + 2)\n\n assert(results[8].value.kind == 'C' and results[8].time == 250)", "metadata": "root.TestMerge.test_merge_lots2", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 201 }, { "content": " def test_merge_lots3(self):\n scheduler = TestScheduler()\n msgs1 = [on_next(150, 1), on_next(210, 2), on_next(225, 5), on_next(240, 8), on_completed(245)]\n msgs2 = [on_next(150, 1), on_next(215, 3), on_next(230, 6), on_next(245, 9), on_completed(250)]\n msgs3 = [on_next(150, 1), on_next(220, 4), on_next(235, 7), on_completed(240)]\n o1 = scheduler.create_hot_observable(msgs1)\n o2 = scheduler.create_hot_observable(msgs2)\n o3 = scheduler.create_hot_observable(msgs3)\n\n def create():\n return Observable.merge(scheduler, o1, o2, o3)\n\n results = scheduler.start(create).messages\n assert(len(results) == 9)\n for i, result in enumerate(results[:-1]):\n assert(results[i].value.kind == 'N' and results[i].time == 210 + i * 5 and results[i].value.value == i + 2)\n\n assert(results[8].value.kind == 'C' and results[8].time == 250)", "metadata": "root.TestMerge.test_merge_lots3", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 220 }, { "content": " def test_merge_error_left(self):\n ex = 'ex'\n scheduler = TestScheduler()\n msgs1 = [on_next(150, 1), on_next(210, 2), on_error(245, ex)]\n msgs2 = [on_next(150, 1), on_next(215, 3), on_completed(250)]\n o1 = scheduler.create_hot_observable(msgs1)\n o2 = scheduler.create_hot_observable(msgs2)\n\n def create():\n return Observable.merge(scheduler, o1, o2)\n\n results = scheduler.start(create)\n results.messages.assert_equal(on_next(210, 2), on_next(215, 3), on_error(245, ex))", "metadata": "root.TestMerge.test_merge_error_left", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 239 }, { "content": " def test_merge_error_causes_disposal(self):\n ex = 'ex'\n scheduler = TestScheduler()\n msgs1 = [on_next(150, 1), on_error(210, ex)]\n msgs2 = [on_next(150, 1), on_next(220, 1), on_completed(250)]\n source_not_disposed = [False]\n o1 = scheduler.create_hot_observable(msgs1)\n\n def action():\n source_not_disposed[0] = True\n\n o2 = scheduler.create_hot_observable(msgs2).do_action(on_next=action)\n\n def create():\n return Observable.merge(scheduler, o1, o2)\n\n results = scheduler.start(create)\n\n results.messages.assert_equal(on_error(210, ex))\n assert(not source_not_disposed[0])", "metadata": "root.TestMerge.test_merge_error_causes_disposal", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 253 }, { "content": " def test_merge_observable_of_observable_data(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(300, scheduler.create_cold_observable(on_next(10, 101), on_next(20, 102), on_next(110, 103), on_next(120, 104), on_next(210, 105), on_next(220, 106), on_completed(230))), on_next(400, scheduler.create_cold_observable(on_next(10, 201), on_next(20, 202), on_next(30, 203), on_next(40, 204), on_completed(50))), on_next(500, scheduler.create_cold_observable(on_next(10, 301), on_next(20, 302), on_next(30, 303), on_next(40, 304), on_next(120, 305), on_completed(150))), on_completed(600))\n\n def create():\n return xs.merge_observable()\n results = scheduler.start(create)\n results.messages.assert_equal(on_next(310, 101), on_next(320, 102), on_next(410, 103), on_next(410, 201), on_next(420, 104), on_next(420, 202), on_next(430, 203), on_next(440, 204), on_next(510, 105), on_next(510, 301), on_next(520, 106), on_next(520, 302), on_next(530, 303), on_next(540, 304), on_next(620, 305), on_completed(650))", "metadata": "root.TestMerge.test_merge_observable_of_observable_data", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 274 }, { "content": " def test_merge_observable_of_observable_data_non_overlapped(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(300, scheduler.create_cold_observable(on_next(10, 101), on_next(20, 102), on_completed(230))), on_next(400, scheduler.create_cold_observable(on_next(10, 201), on_next(20, 202), on_next(30, 203), on_next(40, 204), on_completed(50))), on_next(500, scheduler.create_cold_observable(on_next(10, 301), on_next(20, 302), on_next(30, 303), on_next(40, 304), on_completed(50))), on_completed(600))\n\n def create():\n return xs.merge_observable()\n\n results = scheduler.start(create)\n results.messages.assert_equal(on_next(310, 101), on_next(320, 102), on_next(410, 201), on_next(420, 202), on_next(430, 203), on_next(440, 204), on_next(510, 301), on_next(520, 302), on_next(530, 303), on_next(540, 304), on_completed(600))", "metadata": "root.TestMerge.test_merge_observable_of_observable_data_non_overlapped", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 283 }, { "content": " def test_merge_observable_of_observable_inner_throws(self):\n ex = 'ex'\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(300, scheduler.create_cold_observable(on_next(10, 101), on_next(20, 102), on_completed(230))), on_next(400, scheduler.create_cold_observable(on_next(10, 201), on_next(20, 202), on_next(30, 203), on_next(40, 204), on_error(50, ex))), on_next(500, scheduler.create_cold_observable(on_next(10, 301), on_next(20, 302), on_next(30, 303), on_next(40, 304), on_completed(50))), on_completed(600))\n\n def create():\n return xs.merge_observable()\n\n results = scheduler.start(create)\n results.messages.assert_equal(on_next(310, 101), on_next(320, 102), on_next(410, 201), on_next(420, 202), on_next(430, 203), on_next(440, 204), on_error(450, ex))", "metadata": "root.TestMerge.test_merge_observable_of_observable_inner_throws", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 293 }, { "content": " def test_merge_observable_of_observable_outer_throws(self):\n ex = 'ex'\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(300, scheduler.create_cold_observable(on_next(10, 101), on_next(20, 102), on_completed(230))), on_next(400, scheduler.create_cold_observable(on_next(10, 201), on_next(20, 202), on_next(30, 203), on_next(40, 204), on_completed(50))), on_error(500, ex))\n\n def create():\n return xs.merge_observable()\n results = scheduler.start(create)\n results.messages.assert_equal(on_next(310, 101), on_next(320, 102), on_next(410, 201), on_next(420, 202), on_next(430, 203), on_next(440, 204), on_error(500, ex))", "metadata": "root.TestMerge.test_merge_observable_of_observable_outer_throws", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 304 }, { "content": " def test_mergeconcat_basic(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(210, scheduler.create_cold_observable(on_next(50, 1), on_next(100, 2), on_next(120, 3), on_completed(140))), on_next(260, scheduler.create_cold_observable(on_next(20, 4), on_next(70, 5), on_completed(200))), on_next(270, scheduler.create_cold_observable(on_next(10, 6), on_next(90, 7), on_next(110, 8), on_completed(130))), on_next(320, scheduler.create_cold_observable(on_next(210, 9), on_next(240, 10), on_completed(300))), on_completed(400))\n\n def create():\n return xs.merge(2)\n\n results = scheduler.start(create)\n\n results.messages.assert_equal(on_next(260, 1), on_next(280, 4), on_next(310, 2), on_next(330, 3), on_next(330, 5), on_next(360, 6), on_next(440, 7), on_next(460, 8), on_next(670, 9), on_next(700, 10), on_completed(760))\n xs.subscriptions.assert_equal(subscribe(200, 760))", "metadata": "root.TestMerge.test_mergeconcat_basic", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 314 }, { "content": " def test_mergeconcat_basic_long(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(210, scheduler.create_cold_observable(on_next(50, 1), on_next(100, 2), on_next(120, 3), on_completed(140))), on_next(260, scheduler.create_cold_observable(on_next(20, 4), on_next(70, 5), on_completed(300))), on_next(270, scheduler.create_cold_observable(on_next(10, 6), on_next(90, 7), on_next(110, 8), on_completed(130))), on_next(320, scheduler.create_cold_observable(on_next(210, 9), on_next(240, 10), on_completed(300))), on_completed(400))\n\n def create():\n return xs.merge(2)\n\n results = scheduler.start(create)\n\n results.messages.assert_equal(on_next(260, 1), on_next(280, 4), on_next(310, 2), on_next(330, 3), on_next(330, 5), on_next(360, 6), on_next(440, 7), on_next(460, 8), on_next(690, 9), on_next(720, 10), on_completed(780))\n xs.subscriptions.assert_equal(subscribe(200, 780))", "metadata": "root.TestMerge.test_mergeconcat_basic_long", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 326 }, { "content": " def test_mergeconcat_basic_wide(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(210, scheduler.create_cold_observable(on_next(50, 1), on_next(100, 2), on_next(120, 3), on_completed(140))), on_next(260, scheduler.create_cold_observable(on_next(20, 4), on_next(70, 5), on_completed(300))), on_next(270, scheduler.create_cold_observable(on_next(10, 6), on_next(90, 7), on_next(110, 8), on_completed(130))), on_next(420, scheduler.create_cold_observable(on_next(210, 9), on_next(240, 10), on_completed(300))), on_completed(450))\n\n def create():\n return xs.merge(3)\n\n results = scheduler.start(create)\n\n results.messages.assert_equal(on_next(260, 1), on_next(280, 4), on_next(280, 6), on_next(310, 2), on_next(330, 3), on_next(330, 5), on_next(360, 7), on_next(380, 8), on_next(630, 9), on_next(660, 10), on_completed(720))\n xs.subscriptions.assert_equal(subscribe(200, 720))", "metadata": "root.TestMerge.test_mergeconcat_basic_wide", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 338 }, { "content": " def test_mergeconcat_basic_late(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(210, scheduler.create_cold_observable(on_next(50, 1), on_next(100, 2), on_next(120, 3), on_completed(140))), on_next(260, scheduler.create_cold_observable(on_next(20, 4), on_next(70, 5), on_completed(300))), on_next(270, scheduler.create_cold_observable(on_next(10, 6), on_next(90, 7), on_next(110, 8), on_completed(130))), on_next(420, scheduler.create_cold_observable(on_next(210, 9), on_next(240, 10), on_completed(300))), on_completed(750))\n\n def create():\n return xs.merge(3)\n\n results = scheduler.start(create)\n\n results.messages.assert_equal(on_next(260, 1), on_next(280, 4), on_next(280, 6), on_next(310, 2), on_next(330, 3), on_next(330, 5), on_next(360, 7), on_next(380, 8), on_next(630, 9), on_next(660, 10), on_completed(750))\n xs.subscriptions.assert_equal(subscribe(200, 750))", "metadata": "root.TestMerge.test_mergeconcat_basic_late", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 350 }, { "content": " def test_mergeconcat_disposed(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(210, scheduler.create_cold_observable(on_next(50, 1), on_next(100, 2), on_next(120, 3), on_completed(140))), on_next(260, scheduler.create_cold_observable(on_next(20, 4), on_next(70, 5), on_completed(200))), on_next(270, scheduler.create_cold_observable(on_next(10, 6), on_next(90, 7), on_next(110, 8), on_completed(130))), on_next(320, scheduler.create_cold_observable(on_next(210, 9), on_next(240, 10), on_completed(300))), on_completed(400))\n\n def create():\n return xs.merge(2)\n\n results = scheduler.start(create, disposed=450)\n results.messages.assert_equal(on_next(260, 1), on_next(280, 4), on_next(310, 2), on_next(330, 3), on_next(330, 5), on_next(360, 6), on_next(440, 7))\n xs.subscriptions.assert_equal(subscribe(200, 450))", "metadata": "root.TestMerge.test_mergeconcat_disposed", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 362 }, { "content": " def test_mergeconcat_outererror(self):\n ex = 'ex'\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(210, scheduler.create_cold_observable(on_next(50, 1), on_next(100, 2), on_next(120, 3), on_completed(140))), on_next(260, scheduler.create_cold_observable(on_next(20, 4), on_next(70, 5), on_completed(200))), on_next(270, scheduler.create_cold_observable(on_next(10, 6), on_next(90, 7), on_next(110, 8), on_completed(130))), on_next(320, scheduler.create_cold_observable(on_next(210, 9), on_next(240, 10), on_completed(300))), on_error(400, ex))\n\n def create():\n return xs.merge(2)\n results = scheduler.start(create)\n\n results.messages.assert_equal(on_next(260, 1), on_next(280, 4), on_next(310, 2), on_next(330, 3), on_next(330, 5), on_next(360, 6), on_error(400, ex))\n xs.subscriptions.assert_equal(subscribe(200, 400))", "metadata": "root.TestMerge.test_mergeconcat_outererror", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 373 }, { "content": " def test_mergeconcat_innererror(self):\n ex = 'ex'\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(210, scheduler.create_cold_observable(on_next(50, 1), on_next(100, 2), on_next(120, 3), on_completed(140))), on_next(260, scheduler.create_cold_observable(on_next(20, 4), on_next(70, 5), on_completed(200))), on_next(270, scheduler.create_cold_observable(on_next(10, 6), on_next(90, 7), on_next(110, 8), on_error(140, ex))), on_next(320, scheduler.create_cold_observable(on_next(210, 9), on_next(240, 10), on_completed(300))), on_completed(400))\n\n def create():\n return xs.merge(2)\n\n results = scheduler.start(create)\n\n results.messages.assert_equal(on_next(260, 1), on_next(280, 4), on_next(310, 2), on_next(330, 3), on_next(330, 5), on_next(360, 6), on_next(440, 7), on_next(460, 8), on_error(490, ex))\n xs.subscriptions.assert_equal(subscribe(200, 490))", "metadata": "root.TestMerge.test_mergeconcat_innererror", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 385 }, { "content": " def test_merge_112233(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(\n on_next(250, 1), on_next(300, 2), on_next(350, 3), on_completed(360))\n ys = scheduler.create_hot_observable(\n on_next(250, 1), on_next(300, 2), on_next(320, 3), on_completed(340))\n\n def create():\n return xs.merge(ys)\n\n results = scheduler.start(create)\n\n results.messages.assert_equal(\n on_next(250, 1),\n on_next(250, 1),\n on_next(300, 2),\n on_next(300, 2),\n on_next(320, 3),\n on_next(350, 3),\n on_completed(360))\n xs.subscriptions.assert_equal(subscribe(200, 360))", "metadata": "root.TestMerge.test_merge_112233", "header": "['class', 'TestMerge', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 398 } ]
[ { "span": "from rx.testing import TestScheduler, ReactiveTest, is_prime, MockDisposable", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 76 }, { "span": "from rx.disposables import Disposable, SerialDisposable", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 55 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "rx_", "import_", "Observable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rx_", "._", "testing_", "import_", "Test", "Scheduler_", ",_", "React", "ive", "Test_", ",_", "is", "\\u", "prime_", ",_", "Moc", "k", "Dispo", "sab", "le_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rx_", "._", "dispo", "sab", "les_", "import_", "Dispo", "sab", "le_", ",_", "Ser", "ial", "Dispo", "sab", "le_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "=_", "React", "ive", "Test_", "._", "on", "\\u", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "on", "\\u", "completed_", "=_", "React", "ive", "Test_", "._", "on", "\\u", "completed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "on", "\\u", "error_", "=_", "React", "ive", "Test_", "._", "on", "\\u", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscribe_", "=_", "React", "ive", "Test_", "._", "subscribe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscribed", "_", "=_", "React", "ive", "Test_", "._", "subscribed", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dispose", "d_", "=_", "React", "ive", "Test_", "._", "dispose", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created_", "=_", "React", "ive", "Test_", "._", "created_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "merge", "\\u", "neve", "r2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n1_", "=_", "Observable_", "._", "neve", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n2_", "=_", "Observable_", "._", "neve", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Observable_", "._", "merge_", "(_", "scheduler_", ",_", "n1_", ",_", "n2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "\\u", "neve", "r3_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n1_", "=_", "Observable_", "._", "neve", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n2_", "=_", "Observable_", "._", "neve", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n3_", "=_", "Observable_", "._", "neve", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Observable_", "._", "merge_", "(_", "scheduler_", ",_", "n1_", ",_", "n2_", ",_", "n3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "\\u", "empty", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e1_", "=_", "Observable_", "._", "empty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e2_", "=_", "Observable_", "._", "empty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Observable_", "._", "merge_", "(_", "scheduler_", ",_", "e1_", ",_", "e2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "completed_", "(_", "203_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "\\u", "empty", "3_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e1_", "=_", "Observable_", "._", "empty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e2_", "=_", "Observable_", "._", "empty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e3_", "=_", "Observable_", "._", "empty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Observable_", "._", "merge_", "(_", "scheduler_", ",_", "e1_", ",_", "e2_", ",_", "e3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "completed_", "(_", "204_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "\\u", "empty", "\\u", "delayed", "2", "\\u", "right", "\\u", "last_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l\\u", "msgs_", "=_", "[_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "completed_", "(_", "240_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r", "\\u", "msgs_", "=_", "[_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e1_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "l\\u", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e2_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "r", "\\u", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Observable_", "._", "merge_", "(_", "scheduler_", ",_", "e1_", ",_", "e2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "\\u", "empty", "\\u", "delayed", "2", "\\u", "left", "\\u", "last_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l\\u", "msgs_", "=_", "[_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r", "\\u", "msgs_", "=_", "[_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "completed_", "(_", "240_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e1_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "l\\u", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e2_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "r", "\\u", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Observable_", "._", "merge_", "(_", "scheduler_", ",_", "e1_", ",_", "e2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "\\u", "empty", "\\u", "delayed", "3", "\\u", "middle", "\\u", "last_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs", "1_", "=_", "[_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "completed_", "(_", "245_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs", "2_", "=_", "[_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs", "3_", "=_", "[_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "completed_", "(_", "240_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e1_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "msgs", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e2_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "msgs", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e3_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "msgs", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Observable_", "._", "merge_", "(_", "scheduler_", ",_", "e1_", ",_", "e2_", ",_", "e3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "\\u", "empty", "\\u", "neve", "r_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs", "1_", "=_", "[_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "completed_", "(_", "245_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e1_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "msgs", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n1_", "=_", "Observable_", "._", "neve", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Observable_", "._", "merge_", "(_", "scheduler_", ",_", "e1_", ",_", "n1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "\\u", "neve", "r", "\\u", "empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs", "1_", "=_", "[_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "completed_", "(_", "245_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e1_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "msgs", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n1_", "=_", "Observable_", "._", "neve", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Observable_", "._", "merge_", "(_", "scheduler_", ",_", "n1_", ",_", "e1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "\\u", "return", "\\u", "neve", "r_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs", "1_", "=_", "[_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "completed_", "(_", "245_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r1_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "msgs", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n1_", "=_", "Observable_", "._", "neve", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Observable_", "._", "merge_", "(_", "scheduler_", ",_", "r1_", ",_", "n1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "\\u", "neve", "r", "\\u", "return_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs", "1_", "=_", "[_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "completed_", "(_", "245_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r1_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "msgs", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n1_", "=_", "Observable_", "._", "neve", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Observable_", "._", "merge_", "(_", "scheduler_", ",_", "n1_", ",_", "r1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "\\u", "error", "\\u", "neve", "r_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "=_", "'", "ex", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs", "1_", "=_", "[_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "error_", "(_", "245_", ",_", "ex_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e1_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "msgs", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n1_", "=_", "Observable_", "._", "neve", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Observable_", "._", "merge_", "(_", "scheduler_", ",_", "e1_", ",_", "n1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "error_", "(_", "245_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "\\u", "neve", "r", "\\u", "error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "=_", "'", "ex", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs", "1_", "=_", "[_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "error_", "(_", "245_", ",_", "ex_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e1_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "msgs", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n1_", "=_", "Observable_", "._", "neve", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Observable_", "._", "merge_", "(_", "scheduler_", ",_", "n1_", ",_", "e1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "error_", "(_", "245_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "\\u", "empty", "\\u", "return_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs", "1_", "=_", "[_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "completed_", "(_", "245_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs", "2_", "=_", "[_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e1_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "msgs", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r1_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "msgs", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Observable_", "._", "merge_", "(_", "scheduler_", ",_", "e1_", ",_", "r1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "\\u", "return", "\\u", "empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs", "1_", "=_", "[_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "completed_", "(_", "245_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs", "2_", "=_", "[_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e1_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "msgs", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r1_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "msgs", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Observable_", "._", "merge_", "(_", "scheduler_", ",_", "r1_", ",_", "e1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "\\u", "lots", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs", "1_", "=_", "[_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "220_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "230_", ",_", "6_", ")_", ",_", "on", "\\u", "next_", "(_", "240_", ",_", "8_", ")_", ",_", "on", "\\u", "completed_", "(_", "245_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs", "2_", "=_", "[_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "215_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "225_", ",_", "5_", ")_", ",_", "on", "\\u", "next_", "(_", "235_", ",_", "7_", ")_", ",_", "on", "\\u", "next_", "(_", "245_", ",_", "9_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o1_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "msgs", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o2_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "msgs", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Observable_", "._", "merge_", "(_", "scheduler_", ",_", "o1_", ",_", "o2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "._", "messages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "len_", "(_", "results_", ")_", "==_", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "result_", "in_", "enumerate_", "(_", "results_", "[_", ":_", "-_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "(_", "result_", "._", "value_", "._", "kind_", "==_", "'", "N", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "result_", "._", "time_", "==_", "210_", "+_", "i_", "*_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "result_", "._", "value_", "._", "value_", "==_", "i_", "+_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "(_", "results_", "[_", "8_", "]_", "._", "value_", "._", "kind_", "==_", "'", "C", "'_", "and_", "results_", "[_", "8_", "]_", "._", "time_", "==_", "250_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "\\u", "lots", "3_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs", "1_", "=_", "[_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "225_", ",_", "5_", ")_", ",_", "on", "\\u", "next_", "(_", "240_", ",_", "8_", ")_", ",_", "on", "\\u", "completed_", "(_", "245_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs", "2_", "=_", "[_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "215_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "230_", ",_", "6_", ")_", ",_", "on", "\\u", "next_", "(_", "245_", ",_", "9_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs", "3_", "=_", "[_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "220_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "235_", ",_", "7_", ")_", ",_", "on", "\\u", "completed_", "(_", "240_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o1_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "msgs", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o2_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "msgs", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o3", "_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "msgs", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Observable_", "._", "merge_", "(_", "scheduler_", ",_", "o1_", ",_", "o2_", ",_", "o3", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "._", "messages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "len_", "(_", "results_", ")_", "==_", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "result_", "in_", "enumerate_", "(_", "results_", "[_", ":_", "-_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "(_", "results_", "[_", "i_", "]_", "._", "value_", "._", "kind_", "==_", "'", "N", "'_", "and_", "results_", "[_", "i_", "]_", "._", "time_", "==_", "210_", "+_", "i_", "*_", "5_", "and_", "results_", "[_", "i_", "]_", "._", "value_", "._", "value_", "==_", "i_", "+_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "(_", "results_", "[_", "8_", "]_", "._", "value_", "._", "kind_", "==_", "'", "C", "'_", "and_", "results_", "[_", "8_", "]_", "._", "time_", "==_", "250_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "\\u", "error", "\\u", "left_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "=_", "'", "ex", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs", "1_", "=_", "[_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "error_", "(_", "245_", ",_", "ex_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs", "2_", "=_", "[_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "215_", ",_", "3_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o1_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "msgs", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o2_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "msgs", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Observable_", "._", "merge_", "(_", "scheduler_", ",_", "o1_", ",_", "o2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "215_", ",_", "3_", ")_", ",_", "on", "\\u", "error_", "(_", "245_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "\\u", "error", "\\u", "caus", "es", "\\u", "dispo", "sal", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "=_", "'", "ex", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs", "1_", "=_", "[_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "error_", "(_", "210_", ",_", "ex_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs", "2_", "=_", "[_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "220_", ",_", "1_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "\\u", "not", "\\u", "dispose", "d_", "=_", "[_", "False_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o1_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "msgs", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "action_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source", "\\u", "not", "\\u", "dispose", "d_", "[_", "0_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "o2_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "msgs", "2_", ")_", "._", "do", "\\u", "action_", "(_", "on", "\\u", "next_", "=_", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Observable_", "._", "merge_", "(_", "scheduler_", ",_", "o1_", ",_", "o2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "error_", "(_", "210_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "not_", "source", "\\u", "not", "\\u", "dispose", "d_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "\\u", "observable", "\\u", "of", "\\u", "observable", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "300_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "101_", ")_", ",_", "on", "\\u", "next_", "(_", "20_", ",_", "102_", ")_", ",_", "on", "\\u", "next_", "(_", "110_", ",_", "103_", ")_", ",_", "on", "\\u", "next_", "(_", "120_", ",_", "104_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "105_", ")_", ",_", "on", "\\u", "next_", "(_", "220_", ",_", "106_", ")_", ",_", "on", "\\u", "completed_", "(_", "230_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "400_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "201_", ")_", ",_", "on", "\\u", "next_", "(_", "20_", ",_", "202_", ")_", ",_", "on", "\\u", "next_", "(_", "30_", ",_", "203_", ")_", ",_", "on", "\\u", "next_", "(_", "40_", ",_", "204_", ")_", ",_", "on", "\\u", "completed_", "(_", "50_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "500_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "301_", ")_", ",_", "on", "\\u", "next_", "(_", "20_", ",_", "302_", ")_", ",_", "on", "\\u", "next_", "(_", "30_", ",_", "303_", ")_", ",_", "on", "\\u", "next_", "(_", "40_", ",_", "304_", ")_", ",_", "on", "\\u", "next_", "(_", "120_", ",_", "305_", ")_", ",_", "on", "\\u", "completed_", "(_", "150_", ")_", ")_", ")_", ",_", "on", "\\u", "completed_", "(_", "600_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "merge", "\\u", "observable_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "310_", ",_", "101_", ")_", ",_", "on", "\\u", "next_", "(_", "320_", ",_", "102_", ")_", ",_", "on", "\\u", "next_", "(_", "410", "_", ",_", "103_", ")_", ",_", "on", "\\u", "next_", "(_", "410", "_", ",_", "201_", ")_", ",_", "on", "\\u", "next_", "(_", "420_", ",_", "104_", ")_", ",_", "on", "\\u", "next_", "(_", "420_", ",_", "202_", ")_", ",_", "on", "\\u", "next_", "(_", "430", "_", ",_", "203_", ")_", ",_", "on", "\\u", "next_", "(_", "440_", ",_", "204_", ")_", ",_", "on", "\\u", "next_", "(_", "510", "_", ",_", "105_", ")_", ",_", "on", "\\u", "next_", "(_", "510", "_", ",_", "301_", ")_", ",_", "on", "\\u", "next_", "(_", "520", "_", ",_", "106_", ")_", ",_", "on", "\\u", "next_", "(_", "520", "_", ",_", "302_", ")_", ",_", "on", "\\u", "next_", "(_", "530", "_", ",_", "303_", ")_", ",_", "on", "\\u", "next_", "(_", "540", "_", ",_", "304_", ")_", ",_", "on", "\\u", "next_", "(_", "620", "_", ",_", "305_", ")_", ",_", "on", "\\u", "completed_", "(_", "650_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "\\u", "observable", "\\u", "of", "\\u", "observable", "\\u", "data\\u", "non", "\\u", "overl", "appe", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "300_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "101_", ")_", ",_", "on", "\\u", "next_", "(_", "20_", ",_", "102_", ")_", ",_", "on", "\\u", "completed_", "(_", "230_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "400_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "201_", ")_", ",_", "on", "\\u", "next_", "(_", "20_", ",_", "202_", ")_", ",_", "on", "\\u", "next_", "(_", "30_", ",_", "203_", ")_", ",_", "on", "\\u", "next_", "(_", "40_", ",_", "204_", ")_", ",_", "on", "\\u", "completed_", "(_", "50_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "500_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "301_", ")_", ",_", "on", "\\u", "next_", "(_", "20_", ",_", "302_", ")_", ",_", "on", "\\u", "next_", "(_", "30_", ",_", "303_", ")_", ",_", "on", "\\u", "next_", "(_", "40_", ",_", "304_", ")_", ",_", "on", "\\u", "completed_", "(_", "50_", ")_", ")_", ")_", ",_", "on", "\\u", "completed_", "(_", "600_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "merge", "\\u", "observable_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "310_", ",_", "101_", ")_", ",_", "on", "\\u", "next_", "(_", "320_", ",_", "102_", ")_", ",_", "on", "\\u", "next_", "(_", "410", "_", ",_", "201_", ")_", ",_", "on", "\\u", "next_", "(_", "420_", ",_", "202_", ")_", ",_", "on", "\\u", "next_", "(_", "430", "_", ",_", "203_", ")_", ",_", "on", "\\u", "next_", "(_", "440_", ",_", "204_", ")_", ",_", "on", "\\u", "next_", "(_", "510", "_", ",_", "301_", ")_", ",_", "on", "\\u", "next_", "(_", "520", "_", ",_", "302_", ")_", ",_", "on", "\\u", "next_", "(_", "530", "_", ",_", "303_", ")_", ",_", "on", "\\u", "next_", "(_", "540", "_", ",_", "304_", ")_", ",_", "on", "\\u", "completed_", "(_", "600_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "\\u", "observable", "\\u", "of", "\\u", "observable", "\\u", "inner", "\\u", "throw", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "=_", "'", "ex", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "300_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "101_", ")_", ",_", "on", "\\u", "next_", "(_", "20_", ",_", "102_", ")_", ",_", "on", "\\u", "completed_", "(_", "230_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "400_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "201_", ")_", ",_", "on", "\\u", "next_", "(_", "20_", ",_", "202_", ")_", ",_", "on", "\\u", "next_", "(_", "30_", ",_", "203_", ")_", ",_", "on", "\\u", "next_", "(_", "40_", ",_", "204_", ")_", ",_", "on", "\\u", "error_", "(_", "50_", ",_", "ex_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "500_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "301_", ")_", ",_", "on", "\\u", "next_", "(_", "20_", ",_", "302_", ")_", ",_", "on", "\\u", "next_", "(_", "30_", ",_", "303_", ")_", ",_", "on", "\\u", "next_", "(_", "40_", ",_", "304_", ")_", ",_", "on", "\\u", "completed_", "(_", "50_", ")_", ")_", ")_", ",_", "on", "\\u", "completed_", "(_", "600_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "merge", "\\u", "observable_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "310_", ",_", "101_", ")_", ",_", "on", "\\u", "next_", "(_", "320_", ",_", "102_", ")_", ",_", "on", "\\u", "next_", "(_", "410", "_", ",_", "201_", ")_", ",_", "on", "\\u", "next_", "(_", "420_", ",_", "202_", ")_", ",_", "on", "\\u", "next_", "(_", "430", "_", ",_", "203_", ")_", ",_", "on", "\\u", "next_", "(_", "440_", ",_", "204_", ")_", ",_", "on", "\\u", "error_", "(_", "450_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "\\u", "observable", "\\u", "of", "\\u", "observable", "\\u", "outer", "\\u", "throw", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "=_", "'", "ex", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "300_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "101_", ")_", ",_", "on", "\\u", "next_", "(_", "20_", ",_", "102_", ")_", ",_", "on", "\\u", "completed_", "(_", "230_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "400_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "201_", ")_", ",_", "on", "\\u", "next_", "(_", "20_", ",_", "202_", ")_", ",_", "on", "\\u", "next_", "(_", "30_", ",_", "203_", ")_", ",_", "on", "\\u", "next_", "(_", "40_", ",_", "204_", ")_", ",_", "on", "\\u", "completed_", "(_", "50_", ")_", ")_", ")_", ",_", "on", "\\u", "error_", "(_", "500_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "merge", "\\u", "observable_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "310_", ",_", "101_", ")_", ",_", "on", "\\u", "next_", "(_", "320_", ",_", "102_", ")_", ",_", "on", "\\u", "next_", "(_", "410", "_", ",_", "201_", ")_", ",_", "on", "\\u", "next_", "(_", "420_", ",_", "202_", ")_", ",_", "on", "\\u", "next_", "(_", "430", "_", ",_", "203_", ")_", ",_", "on", "\\u", "next_", "(_", "440_", ",_", "204_", ")_", ",_", "on", "\\u", "error_", "(_", "500_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "conc", "at", "\\u", "basic_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "210_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "50_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "100_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "120_", ",_", "3_", ")_", ",_", "on", "\\u", "completed_", "(_", "140_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "260_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "20_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "70_", ",_", "5_", ")_", ",_", "on", "\\u", "completed_", "(_", "200_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "270_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "6_", ")_", ",_", "on", "\\u", "next_", "(_", "90_", ",_", "7_", ")_", ",_", "on", "\\u", "next_", "(_", "110_", ",_", "8_", ")_", ",_", "on", "\\u", "completed_", "(_", "130_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "320_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "210_", ",_", "9_", ")_", ",_", "on", "\\u", "next_", "(_", "240_", ",_", "10_", ")_", ",_", "on", "\\u", "completed_", "(_", "300_", ")_", ")_", ")_", ",_", "on", "\\u", "completed_", "(_", "400_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "merge_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "260_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "280_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "310_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "330_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "330_", ",_", "5_", ")_", ",_", "on", "\\u", "next_", "(_", "360_", ",_", "6_", ")_", ",_", "on", "\\u", "next_", "(_", "440_", ",_", "7_", ")_", ",_", "on", "\\u", "next_", "(_", "460", "_", ",_", "8_", ")_", ",_", "on", "\\u", "next_", "(_", "670", "_", ",_", "9_", ")_", ",_", "on", "\\u", "next_", "(_", "700_", ",_", "10_", ")_", ",_", "on", "\\u", "completed_", "(_", "760", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "760", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "conc", "at", "\\u", "basic", "\\u", "long_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "210_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "50_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "100_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "120_", ",_", "3_", ")_", ",_", "on", "\\u", "completed_", "(_", "140_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "260_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "20_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "70_", ",_", "5_", ")_", ",_", "on", "\\u", "completed_", "(_", "300_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "270_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "6_", ")_", ",_", "on", "\\u", "next_", "(_", "90_", ",_", "7_", ")_", ",_", "on", "\\u", "next_", "(_", "110_", ",_", "8_", ")_", ",_", "on", "\\u", "completed_", "(_", "130_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "320_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "210_", ",_", "9_", ")_", ",_", "on", "\\u", "next_", "(_", "240_", ",_", "10_", ")_", ",_", "on", "\\u", "completed_", "(_", "300_", ")_", ")_", ")_", ",_", "on", "\\u", "completed_", "(_", "400_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "merge_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "260_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "280_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "310_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "330_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "330_", ",_", "5_", ")_", ",_", "on", "\\u", "next_", "(_", "360_", ",_", "6_", ")_", ",_", "on", "\\u", "next_", "(_", "440_", ",_", "7_", ")_", ",_", "on", "\\u", "next_", "(_", "460", "_", ",_", "8_", ")_", ",_", "on", "\\u", "next_", "(_", "690", "_", ",_", "9_", ")_", ",_", "on", "\\u", "next_", "(_", "720_", ",_", "10_", ")_", ",_", "on", "\\u", "completed_", "(_", "780", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "780", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "conc", "at", "\\u", "basic", "\\u", "wide", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "210_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "50_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "100_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "120_", ",_", "3_", ")_", ",_", "on", "\\u", "completed_", "(_", "140_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "260_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "20_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "70_", ",_", "5_", ")_", ",_", "on", "\\u", "completed_", "(_", "300_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "270_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "6_", ")_", ",_", "on", "\\u", "next_", "(_", "90_", ",_", "7_", ")_", ",_", "on", "\\u", "next_", "(_", "110_", ",_", "8_", ")_", ",_", "on", "\\u", "completed_", "(_", "130_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "420_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "210_", ",_", "9_", ")_", ",_", "on", "\\u", "next_", "(_", "240_", ",_", "10_", ")_", ",_", "on", "\\u", "completed_", "(_", "300_", ")_", ")_", ")_", ",_", "on", "\\u", "completed_", "(_", "450_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "merge_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "260_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "280_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "280_", ",_", "6_", ")_", ",_", "on", "\\u", "next_", "(_", "310_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "330_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "330_", ",_", "5_", ")_", ",_", "on", "\\u", "next_", "(_", "360_", ",_", "7_", ")_", ",_", "on", "\\u", "next_", "(_", "380", "_", ",_", "8_", ")_", ",_", "on", "\\u", "next_", "(_", "630", "_", ",_", "9_", ")_", ",_", "on", "\\u", "next_", "(_", "660", "_", ",_", "10_", ")_", ",_", "on", "\\u", "completed_", "(_", "720_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "720_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "conc", "at", "\\u", "basic", "\\u", "late", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "210_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "50_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "100_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "120_", ",_", "3_", ")_", ",_", "on", "\\u", "completed_", "(_", "140_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "260_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "20_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "70_", ",_", "5_", ")_", ",_", "on", "\\u", "completed_", "(_", "300_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "270_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "6_", ")_", ",_", "on", "\\u", "next_", "(_", "90_", ",_", "7_", ")_", ",_", "on", "\\u", "next_", "(_", "110_", ",_", "8_", ")_", ",_", "on", "\\u", "completed_", "(_", "130_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "420_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "210_", ",_", "9_", ")_", ",_", "on", "\\u", "next_", "(_", "240_", ",_", "10_", ")_", ",_", "on", "\\u", "completed_", "(_", "300_", ")_", ")_", ")_", ",_", "on", "\\u", "completed_", "(_", "750_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "merge_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "260_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "280_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "280_", ",_", "6_", ")_", ",_", "on", "\\u", "next_", "(_", "310_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "330_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "330_", ",_", "5_", ")_", ",_", "on", "\\u", "next_", "(_", "360_", ",_", "7_", ")_", ",_", "on", "\\u", "next_", "(_", "380", "_", ",_", "8_", ")_", ",_", "on", "\\u", "next_", "(_", "630", "_", ",_", "9_", ")_", ",_", "on", "\\u", "next_", "(_", "660", "_", ",_", "10_", ")_", ",_", "on", "\\u", "completed_", "(_", "750_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "750_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "conc", "at", "\\u", "dispose", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "210_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "50_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "100_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "120_", ",_", "3_", ")_", ",_", "on", "\\u", "completed_", "(_", "140_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "260_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "20_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "70_", ",_", "5_", ")_", ",_", "on", "\\u", "completed_", "(_", "200_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "270_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "6_", ")_", ",_", "on", "\\u", "next_", "(_", "90_", ",_", "7_", ")_", ",_", "on", "\\u", "next_", "(_", "110_", ",_", "8_", ")_", ",_", "on", "\\u", "completed_", "(_", "130_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "320_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "210_", ",_", "9_", ")_", ",_", "on", "\\u", "next_", "(_", "240_", ",_", "10_", ")_", ",_", "on", "\\u", "completed_", "(_", "300_", ")_", ")_", ")_", ",_", "on", "\\u", "completed_", "(_", "400_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "merge_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ",_", "dispose", "d_", "=_", "450_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "260_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "280_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "310_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "330_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "330_", ",_", "5_", ")_", ",_", "on", "\\u", "next_", "(_", "360_", ",_", "6_", ")_", ",_", "on", "\\u", "next_", "(_", "440_", ",_", "7_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "450_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "conc", "at", "\\u", "outer", "error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "=_", "'", "ex", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "210_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "50_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "100_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "120_", ",_", "3_", ")_", ",_", "on", "\\u", "completed_", "(_", "140_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "260_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "20_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "70_", ",_", "5_", ")_", ",_", "on", "\\u", "completed_", "(_", "200_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "270_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "6_", ")_", ",_", "on", "\\u", "next_", "(_", "90_", ",_", "7_", ")_", ",_", "on", "\\u", "next_", "(_", "110_", ",_", "8_", ")_", ",_", "on", "\\u", "completed_", "(_", "130_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "320_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "210_", ",_", "9_", ")_", ",_", "on", "\\u", "next_", "(_", "240_", ",_", "10_", ")_", ",_", "on", "\\u", "completed_", "(_", "300_", ")_", ")_", ")_", ",_", "on", "\\u", "error_", "(_", "400_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "merge_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "260_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "280_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "310_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "330_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "330_", ",_", "5_", ")_", ",_", "on", "\\u", "next_", "(_", "360_", ",_", "6_", ")_", ",_", "on", "\\u", "error_", "(_", "400_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "400_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "conc", "at", "\\u", "inner", "error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "=_", "'", "ex", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "210_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "50_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "100_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "120_", ",_", "3_", ")_", ",_", "on", "\\u", "completed_", "(_", "140_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "260_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "20_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "70_", ",_", "5_", ")_", ",_", "on", "\\u", "completed_", "(_", "200_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "270_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "6_", ")_", ",_", "on", "\\u", "next_", "(_", "90_", ",_", "7_", ")_", ",_", "on", "\\u", "next_", "(_", "110_", ",_", "8_", ")_", ",_", "on", "\\u", "error_", "(_", "140_", ",_", "ex_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "320_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "210_", ",_", "9_", ")_", ",_", "on", "\\u", "next_", "(_", "240_", ",_", "10_", ")_", ",_", "on", "\\u", "completed_", "(_", "300_", ")_", ")_", ")_", ",_", "on", "\\u", "completed_", "(_", "400_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "merge_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "260_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "280_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "310_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "330_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "330_", ",_", "5_", ")_", ",_", "on", "\\u", "next_", "(_", "360_", ",_", "6_", ")_", ",_", "on", "\\u", "next_", "(_", "440_", ",_", "7_", ")_", ",_", "on", "\\u", "next_", "(_", "460", "_", ",_", "8_", ")_", ",_", "on", "\\u", "error_", "(_", "490", "_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "490", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Merge_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "\\u", "1122", "33_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "250_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "300_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "350_", ",_", "3_", ")_", ",_", "on", "\\u", "completed_", "(_", "360_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ys_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "250_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "300_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "320_", ",_", "3_", ")_", ",_", "on", "\\u", "completed_", "(_", "340_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "merge_", "(_", "ys_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "250_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "250_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "300_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "300_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "320_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "350_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "completed_", "(_", "360_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "360_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
stopstalk/stopstalk-deployment/static/scripts/submissions3.py
[ { "content": "\"\"\"\n Copyright (c) 2015-2016 Raj Patel([email protected]), StopStalk\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n\"\"\"\n\nimport time\nimport traceback\nimport gevent\nfrom datetime import datetime\nfrom gevent import monkey\ngevent.monkey.patch_all(thread=False)\n\n# @ToDo: Make this generalised\nfrom sites import codechef, codeforces, spoj, hackerearth, hackerrank\nN = 0\nrows = []\n\n# -----------------------------------------------------------------------------\n\n# -----------------------------------------------------------------------------\n\n# ----------------------------------------------------------------------------\n\nif __name__ == \"__main__\":\n\n atable = db.auth_user\n cftable = db.custom_friend\n\n columns = \"(`user_id`, `custom_user_id`, `stopstalk_handle`, \" + \\\n \"`site_handle`, `site`, `time_stamp`, `problem_name`,\" + \\\n \"`problem_link`, `lang`, `status`, `points`, `view_link`)\"\n\n # Update the last retrieved of the user\n today = datetime.now()\n\n query = (atable.id % 3 == N) & (atable.blacklisted == False)\n registered_users = db(query).select()\n for record in registered_users:\n retrieve_submissions(record, False)\n\n db(query).update(last_retrieved=today)\n\n query = (cftable.id % 3 == N) & (cftable.duplicate_cu == None)\n custom_users = db(query).select()\n for record in custom_users:\n retrieve_submissions(record, True)\n\n db(query).update(last_retrieved=today)\n\n if len(rows) != 0:\n sql_query = \"\"\"INSERT INTO `submission` \"\"\" + \\\n columns + \"\"\" VALUES \"\"\" + \\\n \",\".join(rows) + \"\"\";\"\"\"\n try:\n db.executesql(sql_query)\n except:\n traceback.print_exc()\n print \"Error in \" + site + \" BULK INSERT for \" + handle\n\n# END =========================================================================\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "cftable.duplicate_cu == None)", "start_line": 177, "start_column": 37, "end_line": 177, "end_column": 65 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Copy", "right", " ", "(", "c", ")", " ", "201", "5", "-", "2016", " ", "Ra", "j", " ", "Pat", "el", "(", "raj", "454", "raj", "@", "gma", "il", ".", "com", "),", " ", "Sto", "p", "Sta", "lk", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", " ", "obtain", "ing", " ", "a", " ", "copy", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", "\\", "10", ";", " ", " ", " ", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", " ", "condition", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", " ", "include", "d", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "all", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "EXPR", "ESS", " ", "OR", "\\", "10", ";", " ", " ", " ", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",", "\\", "10", ";", " ", " ", " ", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "\\", "10", ";", " ", " ", " ", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", "\\", "10", ";", " ", " ", " ", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",", "\\", "10", ";", " ", " ", " ", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN", "\\", "10", ";", " ", " ", " ", " ", "THE", " ", "SOFT", "WARE", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gevent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gevent_", "import_", "monkey_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gevent_", "._", "monkey_", "._", "patch", "\\u", "all_", "(_", "thread_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "To", "Do", ":", " ", "Make", " ", "this", " ", "genera", "lis", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "sites_", "import_", "codec", "hef", "_", ",_", "code", "forces_", ",_", "spo", "j_", ",_", "hacke", "rear", "th_", ",_", "hacke", "rra", "nk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "N_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "atab", "le_", "=_", "db_", "._", "auth", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cf", "table_", "=_", "db_", "._", "custom", "\\u", "friend_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "columns_", "=_", "\"(", "`", "user", "\\u", "id", "`", ",", " ", "`", "custom", "\\u", "user", "\\u", "id", "`", ",", " ", "`", "stop", "stal", "k", "\\u", "handle", "`", ",", " ", "\"_", "+_", "\"`", "site", "\\u", "handle", "`", ",", " ", "`", "site", "`", ",", " ", "`", "time", "\\u", "stamp", "`", ",", " ", "`", "problem", "\\u", "name", "`", ",\"_", "+_", "\"`", "problem", "\\u", "link", "`", ",", " ", "`", "lang", "`", ",", " ", "`", "status", "`", ",", " ", "`", "points", "`", ",", " ", "`", "view", "\\u", "link", "`)", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "the", " ", "last", " ", "retrieved", " ", "of", " ", "the", " ", "user_", "\\u\\u\\uNL\\u\\u\\u_", "today_", "=_", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "query_", "=_", "(_", "atab", "le_", "._", "id_", "%_", "3_", "==_", "N_", ")_", "&_", "(_", "atab", "le_", "._", "blacklisted", "_", "==_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register", "ed", "\\u", "users_", "=_", "db_", "(_", "query_", ")_", "._", "select_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "record_", "in_", "register", "ed", "\\u", "users_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "retrieve", "\\u", "submissions_", "(_", "record_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "(_", "query_", ")_", "._", "update_", "(_", "last", "\\u", "retrieved", "_", "=_", "today_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "query_", "=_", "(_", "cf", "table_", "._", "id_", "%_", "3_", "==_", "N_", ")_", "&_", "(_", "cf", "table_", "._", "duplicat", "e\\u", "cu_", "==_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "custom", "\\u", "users_", "=_", "db_", "(_", "query_", ")_", "._", "select_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "record_", "in_", "custom", "\\u", "users_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "retrieve", "\\u", "submissions_", "(_", "record_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "(_", "query_", ")_", "._", "update_", "(_", "last", "\\u", "retrieved", "_", "=_", "today_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "rows_", ")_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sql", "\\u", "query_", "=_", "\"\"\"", "INSERT", " ", "INT", "O", " ", "`", "subm", "ission", "`", " ", "\"\"\"_", "+_", "columns_", "+_", "\"\"\"", " ", "VALU", "ES", " ", "\"\"\"_", "+_", "\",\"_", "._", "join_", "(_", "rows_", ")_", "+_", "\"\"\"", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "execute", "sql_", "(_", "sql", "\\u", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Error", " ", "in", " ", "\"_", "+_", "site_", "+_", "\"", " ", "BUL", "K", " ", "INSERT", " ", "for", " ", "\"_", "+_", "handle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "END", " ", "==============", "==============", "==============", "==============", "==============", "===", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_",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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
maebert/jrnl/jrnl/cli.py
[ { "content": "def run(manual_args=None):\n args = parse_args(manual_args)\n configure_logger(args.debug)\n args.text = [p.decode('utf-8') if util.PY2 and not isinstance(p, unicode) else p for p in args.text]\n if args.version:\n version_str = \"{0} version {1}\".format(jrnl.__title__, jrnl.__version__)\n print(util.py2encode(version_str))\n sys.exit(0)\n\n if not os.path.exists(CONFIG_PATH):\n log.debug('Configuration file not found, installing jrnl...')\n config = install.install_jrnl(CONFIG_PATH)\n else:\n log.debug('Reading configuration from file %s', CONFIG_PATH)\n config = util.load_and_fix_json(CONFIG_PATH)\n install.upgrade_config(config, config_path=CONFIG_PATH)\n\n if args.ls:\n print(util.py2encode(list_journals(config)))\n sys.exit(0)\n\n log.debug('Using configuration \"%s\"', config)\n original_config = config.copy()\n # check if the configuration is supported by available modules\n if config['encrypt'] and not PYCRYPTO:\n util.prompt(\"According to your jrnl_conf, your journal is encrypted, however PyCrypto was not found. To open your journal, install the PyCrypto package from http://www.pycrypto.org.\")\n sys.exit(1)\n\n # If the first textual argument points to a journal file,\n # use this!\n journal_name = args.text[0] if (args.text and args.text[0] in config['journals']) else 'default'\n if journal_name is not 'default':\n args.text = args.text[1:]\n # If the first remaining argument looks like e.g. '-3', interpret that as a limiter\n if not args.limit and args.text and args.text[0].startswith(\"-\"):\n try:\n args.limit = int(args.text[0].lstrip(\"-\"))\n args.text = args.text[1:]\n except:\n pass\n\n log.debug('Using journal \"%s\"', journal_name)\n journal_conf = config['journals'].get(journal_name)\n if type(journal_conf) is dict: # We can override the default config on a by-journal basis\n log.debug('Updating configuration with specific jourlnal overrides %s', journal_conf)\n config.update(journal_conf)\n else: # But also just give them a string to point to the journal file\n config['journal'] = journal_conf\n\n if config['journal'] is None:\n util.prompt(\"You have not specified a journal. Either provide a default journal in your config file, or specify one of your journals on the command line.\")\n sys.exit(1)\n\n config['journal'] = os.path.expanduser(os.path.expandvars(config['journal']))\n touch_journal(config['journal'])\n log.debug('Using journal path %(journal)s', config)\n mode_compose, mode_export = guess_mode(args, config)\n\n # open journal file or folder\n if os.path.isdir(config['journal']):\n if config['journal'].strip(\"/\").endswith(\".dayone\") or \\\n \"entries\" in os.listdir(config['journal']):\n journal = DayOneJournal.DayOne(**config)\n else:\n util.prompt(\"[Error: {0} is a directory, but doesn't seem to be a DayOne journal either.\".format(config['journal']))\n sys.exit(1)\n else:\n journal = Journal.Journal(journal_name, **config)\n\n # How to quit writing?\n if \"win32\" in sys.platform:\n _exit_multiline_code = \"on a blank line, press Ctrl+Z and then Enter\"\n else:\n _exit_multiline_code = \"press Ctrl+D\"\n\n if mode_compose and not args.text:\n if not sys.stdin.isatty():\n # Piping data into jrnl\n raw = util.py23_read()\n elif config['editor']:\n raw = util.get_text_from_editor(config)\n else:\n try:\n raw = util.py23_read(\"[Compose Entry; \" + _exit_multiline_code + \" to finish writing]\\n\")\n except KeyboardInterrupt:\n util.prompt(\"[Entry NOT saved to journal.]\")\n sys.exit(0)\n if raw:\n args.text = [raw]\n else:\n mode_compose = False\n\n # Writing mode\n if mode_compose:\n raw = \" \".join(args.text).strip()\n if util.PY2 and type(raw) is not unicode:\n raw = raw.decode(sys.getfilesystemencoding())\n log.debug('Appending raw line \"%s\" to journal \"%s\"', raw, journal_name)\n journal.new_entry(raw)\n util.prompt(\"[Entry added to {0} journal]\".format(journal_name))\n journal.write()\n else:\n old_entries = journal.entries\n if args.on_date:\n args.start_date = args.end_date = args.on_date\n journal.filter(tags=args.text,\n start_date=args.start_date, end_date=args.end_date,\n strict=args.strict,\n short=args.short,\n starred=args.starred)\n journal.limit(args.limit)\n\n # Reading mode\n if not mode_compose and not mode_export:\n print(util.py2encode(journal.pprint()))\n\n # Various export modes\n elif args.short:\n print(util.py2encode(journal.pprint(short=True)))\n\n elif args.tags:\n print(util.py2encode(exporters.to_tag_list(journal)))\n\n elif args.export is not False:\n print(util.py2encode(exporters.export(journal, args.export, args.output)))\n\n elif (args.encrypt is not False or args.decrypt is not False) and not PYCRYPTO:\n util.prompt(\"PyCrypto not found. To encrypt or decrypt your journal, install the PyCrypto package from http://www.pycrypto.org.\")\n\n elif args.encrypt is not False:\n encrypt(journal, filename=args.encrypt)\n # Not encrypting to a separate file: update config!\n if not args.encrypt or args.encrypt == config['journal']:\n update_config(original_config, {\"encrypt\": True}, journal_name, force_local=True)\n install.save_config(original_config, config_path=CONFIG_PATH)\n\n elif args.decrypt is not False:\n decrypt(journal, filename=args.decrypt)\n # Not decrypting to a separate file: update config!\n if not args.decrypt or args.decrypt == config['journal']:\n update_config(original_config, {\"encrypt\": False}, journal_name, force_local=True)\n install.save_config(original_config, config_path=CONFIG_PATH)\n\n elif args.edit:\n if not config['editor']:\n util.prompt(\"[You need to specify an editor in {0} to use the --edit function.]\".format(CONFIG_PATH))\n sys.exit(1)\n other_entries = [e for e in old_entries if e not in journal.entries]\n # Edit\n old_num_entries = len(journal)\n edited = util.get_text_from_editor(config, journal.editable_str())\n journal.parse_editable_str(edited)\n num_deleted = old_num_entries - len(journal)\n num_edited = len([e for e in journal.entries if e.modified])\n prompts = []\n if num_deleted:\n prompts.append(\"{0} {1} deleted\".format(num_deleted, \"entry\" if num_deleted == 1 else \"entries\"))\n if num_edited:\n prompts.append(\"{0} {1} modified\".format(num_edited, \"entry\" if num_edited == 1 else \"entries\"))\n if prompts:\n util.prompt(\"[{0}]\".format(\", \".join(prompts).capitalize()))\n journal.entries += other_entries\n journal.sort()\n journal.write()", "metadata": "root.run", "header": "['module', '___EOS___']", "index": 126 } ]
[ { "span": "except:", "start_line": 164, "start_column": 8, "end_line": 164, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "manu", "al", "\\u", "args_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "parse", "\\u", "args_", "(_", "manu", "al", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "configur", "e\\u", "logger_", "(_", "args_", "._", "debug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "._", "text_", "=_", "[_", "p_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "if_", "util_", "._", "PY", "2_", "and_", "not_", "isinstance_", "(_", "p_", ",_", "unicode_", ")_", "else_", "p_", "for_", "p_", "in_", "args_", "._", "text_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "._", "version_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "version", "\\u", "str_", "=_", "\"{", "0", "}", " ", "version", " ", "{", "1", "}\"_", "._", "format_", "(_", "jr", "nl_", "._", "\\u\\u", "title\\u\\u", "_", ",_", "jr", "nl_", "._", "\\u\\u", "version\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "util_", "._", "py2", "encode_", "(_", "version", "\\u", "str_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "CONFIG", "\\u", "PATH_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "'", "Configura", "tion", " ", "file", " ", "not", " ", "found", ",", " ", "install", "ing", " ", "jr", "nl", "...'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "=_", "install_", "._", "install", "\\u", "jr", "nl_", "(_", "CONFIG", "\\u", "PATH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "'", "Reading", " ", "configura", "tion", " ", "from", " ", "file", " ", "%", "s", "'_", ",_", "CONFIG", "\\u", "PATH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "=_", "util_", "._", "load", "\\u", "and", "\\u", "fix", "\\u", "json_", "(_", "CONFIG", "\\u", "PATH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install_", "._", "upgrade", "\\u", "config_", "(_", "config_", ",_", "config", "\\u", "path_", "=_", "CONFIG", "\\u", "PATH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "ls_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "util_", "._", "py2", "encode_", "(_", "list", "\\u", "journal", "s_", "(_", "config_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "debug_", "(_", "'", "Us", "ing", " ", "configura", "tion", " ", "\"%", "s", "\"'_", ",_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "original", "\\u", "config_", "=_", "config_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "the", " ", "configura", "tion", " ", "is", " ", "support", "ed", " ", "by", " ", "avail", "able", " ", "modules_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "config_", "[_", "'", "encrypt", "'_", "]_", "and_", "not_", "PY", "CRYPT", "O_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "util_", "._", "prompt_", "(_", "\"", "Acco", "rdin", "g", " ", "to", " ", "your", " ", "jr", "nl", "\\u", "conf", ",", " ", "your", " ", "journal", " ", "is", " ", "encrypt", "ed", ",", " ", "how", "ever", " ", "Py", "Crypto", " ", "was", " ", "not", " ", "found", ".", " ", "To", " ", "open", " ", "your", " ", "journal", ",", " ", "install", " ", "the", " ", "Py", "Crypto", " ", "package", " ", "from", " ", "http", "://", "www", ".", "pyc", "rypt", "o", ".", "org", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "first", " ", "textu", "al", " ", "argu", "ment", " ", "points", " ", "to", " ", "a", " ", "journal", " ", "file", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "this", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "journal", "\\u", "name_", "=_", "args_", "._", "text_", "[_", "0_", "]_", "if_", "(_", "args_", "._", "text_", "and_", "args_", "._", "text_", "[_", "0_", "]_", "in_", "config_", "[_", "'", "journal", "s", "'_", "]_", ")_", "else_", "'", "default", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "journal", "\\u", "name_", "is_", "not_", "'", "default", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "text_", "=_", "args_", "._", "text_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "first", " ", "rema", "inin", "g", " ", "argu", "ment", " ", "look", "s", " ", "like", " ", "e", ".", "g", ".", " ", "'-", "3", "',", " ", "interpret", " ", "tha", "t", " ", "as", " ", "a", " ", "limiter", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "args_", "._", "limit_", "and_", "args_", "._", "text_", "and_", "args_", "._", "text_", "[_", "0_", "]_", "._", "startswith_", "(_", "\"-\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "limit_", "=_", "int_", "(_", "args_", "._", "text_", "[_", "0_", "]_", "._", "lstrip_", "(_", "\"-\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "._", "text_", "=_", "args_", "._", "text_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "debug_", "(_", "'", "Us", "ing", " ", "journal", " ", "\"%", "s", "\"'_", ",_", "journal", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "journal", "\\u", "conf_", "=_", "config_", "[_", "'", "journal", "s", "'_", "]_", "._", "get_", "(_", "journal", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "journal", "\\u", "conf_", ")_", "is_", "dict_", ":_", "#", " ", "We", " ", "can", " ", "override", " ", "the", " ", "default", " ", "config", " ", "on", " ", "a", " ", "by", "-", "journal", " ", "basis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "'", "Up", "dati", "ng", " ", "configura", "tion", " ", "with", " ", "specific", " ", "jou", "rl", "nal", " ", "override", "s", " ", "%", "s", "'_", ",_", "journal", "\\u", "conf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "._", "update_", "(_", "journal", "\\u", "conf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "Bu", "t", " ", "als", "o", " ", "just", " ", "give", " ", "them", " ", "a", " ", "string", " ", "to", " ", "point", " ", "to", " ", "the", " ", "journal", " ", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "[_", "'", "journal", "'_", "]_", "=_", "journal", "\\u", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "config_", "[_", "'", "journal", "'_", "]_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "util_", "._", "prompt_", "(_", "\"", "You", " ", "have", " ", "not", " ", "specified", " ", "a", " ", "journal", ".", " ", "Ei", "ther", " ", "provide", " ", "a", " ", "default", " ", "journal", " ", "in", " ", "your", " ", "config", " ", "file", ",", " ", "or", " ", "speci", "fy", " ", "one", " ", "of", " ", "your", " ", "journal", "s", " ", "on", " ", "the", " ", "command", " ", "line", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "config_", "[_", "'", "journal", "'_", "]_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "os_", "._", "path_", "._", "expand", "vars_", "(_", "config_", "[_", "'", "journal", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "touch", "\\u", "journal_", "(_", "config_", "[_", "'", "journal", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "'", "Us", "ing", " ", "journal", " ", "path", " ", "%", "(", "journal", ")", "s", "'_", ",_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mode", "\\u", "compose_", ",_", "mode", "\\u", "export_", "=_", "guess", "\\u", "mode_", "(_", "args_", ",_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "journal", " ", "file", " ", "or", " ", "folder_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "config_", "[_", "'", "journal", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "config_", "[_", "'", "journal", "'_", "]_", "._", "strip_", "(_", "\"/\"_", ")_", "._", "endswith_", "(_", "\".", "day", "one", "\"_", ")_", "or_", "\"", "entri", "es", "\"_", "in_", "os_", "._", "listdir_", "(_", "config_", "[_", "'", "journal", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "journal_", "=_", "Day", "One", "Journ", "al_", "._", "Day", "One_", "(_", "**_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "util_", "._", "prompt_", "(_", "\"[", "Error", ":", " ", "{", "0", "}", " ", "is", " ", "a", " ", "director", "y", ",", " ", "but", " ", "doe", "sn", "'", "t", " ", "see", "m", " ", "to", " ", "be", " ", "a", " ", "Day", "One", " ", "journal", " ", "eit", "her", ".\"_", "._", "format_", "(_", "config_", "[_", "'", "journal", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "journal_", "=_", "Journ", "al_", "._", "Journ", "al_", "(_", "journal", "\\u", "name_", ",_", "**_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ho", "w", " ", "to", " ", "quit", " ", "writ", "ing", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "win32", "\"_", "in_", "sys_", "._", "platform_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "exit", "\\u", "multiline", "\\u", "code_", "=_", "\"", "on", " ", "a", " ", "blank", " ", "line", ",", " ", "press", " ", "Ctrl", "+", "Z", " ", "and", " ", "then", " ", "Enter", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "exit", "\\u", "multiline", "\\u", "code_", "=_", "\"", "press", " ", "Ctrl", "+", "D", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "mode", "\\u", "compose_", "and_", "not_", "args_", "._", "text_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "sys_", "._", "stdin_", "._", "isatty_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pi", "ping", " ", "data", " ", "int", "o", " ", "jr", "nl_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raw_", "=_", "util_", "._", "py2", "3", "\\u", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "config_", "[_", "'", "editor", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raw_", "=_", "util_", "._", "get", "\\u", "text", "\\u", "from", "\\u", "editor_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raw_", "=_", "util_", "._", "py2", "3", "\\u", "read_", "(_", "\"[", "Compose", " ", "Entr", "y", ";", " ", "\"_", "+_", "\\u", "exit", "\\u", "multiline", "\\u", "code_", "+_", "\"", " ", "to", " ", "finish", " ", "writ", "ing", "]\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "board", "Interrupt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "util_", "._", "prompt_", "(_", "\"[", "Entr", "y", " ", "NOT", " ", "saved", " ", "to", " ", "journal", ".]", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "raw_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "text_", "=_", "[_", "raw_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mode", "\\u", "compose_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Writ", "ing", " ", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "mode", "\\u", "compose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raw_", "=_", "\"", " ", "\"_", "._", "join_", "(_", "args_", "._", "text_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "util_", "._", "PY", "2_", "and_", "type_", "(_", "raw_", ")_", "is_", "not_", "unicode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raw_", "=_", "raw_", "._", "decode_", "(_", "sys_", "._", "getfile", "system", "encoding_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "debug_", "(_", "'", "Append", "ing", " ", "raw", " ", "line", " ", "\"%", "s", "\"", " ", "to", " ", "journal", " ", "\"%", "s", "\"'_", ",_", "raw_", ",_", "journal", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "journal_", "._", "new", "\\u", "entry_", "(_", "raw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "util_", "._", "prompt_", "(_", "\"[", "Entr", "y", " ", "adde", "d", " ", "to", " ", "{", "0", "}", " ", "journal", "]\"_", "._", "format_", "(_", "journal", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "journal_", "._", "write_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "entries_", "=_", "journal_", "._", "entries_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "._", "on", "\\u", "date_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "start", "\\u", "date_", "=_", "args_", "._", "end", "\\u", "date_", "=_", "args_", "._", "on", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "journal_", "._", "filter_", "(_", "tags_", "=_", "args_", "._", "text_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "date_", "=_", "args_", "._", "start", "\\u", "date_", ",_", "end", "\\u", "date_", "=_", "args_", "._", "end", "\\u", "date_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "strict_", "=_", "args_", "._", "strict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "short_", "=_", "args_", "._", "short_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "starred", "_", "=_", "args_", "._", "starred", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "journal_", "._", "limit_", "(_", "args_", "._", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Reading", " ", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "mode", "\\u", "compose_", "and_", "not_", "mode", "\\u", "export_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "util_", "._", "py2", "encode_", "(_", "journal_", "._", "pprint_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Vari", "ous", " ", "export", " ", "modes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "._", "short_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "util_", "._", "py2", "encode_", "(_", "journal_", "._", "pprint_", "(_", "short_", "=_", "True_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "._", "tags_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "util_", "._", "py2", "encode_", "(_", "exporter", "s_", "._", "to", "\\u", "tag", "\\u", "list_", "(_", "journal_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "._", "export_", "is_", "not_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "util_", "._", "py2", "encode_", "(_", "exporter", "s_", "._", "export_", "(_", "journal_", ",_", "args_", "._", "export_", ",_", "args_", "._", "output_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "args_", "._", "encrypt_", "is_", "not_", "False_", "or_", "args_", "._", "decrypt_", "is_", "not_", "False_", ")_", "and_", "not_", "PY", "CRYPT", "O_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "util_", "._", "prompt_", "(_", "\"", "Py", "Crypto", " ", "not", " ", "found", ".", " ", "To", " ", "encrypt", " ", "or", " ", "decrypt", " ", "your", " ", "journal", ",", " ", "install", " ", "the", " ", "Py", "Crypto", " ", "package", " ", "from", " ", "http", "://", "www", ".", "pyc", "rypt", "o", ".", "org", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "._", "encrypt_", "is_", "not_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "encrypt_", "(_", "journal_", ",_", "filename_", "=_", "args_", "._", "encrypt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", " ", "encrypt", "ing", " ", "to", " ", "a", " ", "separate", " ", "file", ":", " ", "update", " ", "config", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "args_", "._", "encrypt_", "or_", "args_", "._", "encrypt_", "==_", "config_", "[_", "'", "journal", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "update", "\\u", "config_", "(_", "original", "\\u", "config_", ",_", "{_", "\"", "encrypt", "\"_", ":_", "True_", "}_", ",_", "journal", "\\u", "name_", ",_", "force", "\\u", "local_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install_", "._", "save", "\\u", "config_", "(_", "original", "\\u", "config_", ",_", "config", "\\u", "path_", "=_", "CONFIG", "\\u", "PATH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "._", "decrypt_", "is_", "not_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "decrypt_", "(_", "journal_", ",_", "filename_", "=_", "args_", "._", "decrypt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", " ", "decrypt", "ing", " ", "to", " ", "a", " ", "separate", " ", "file", ":", " ", "update", " ", "config", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "args_", "._", "decrypt_", "or_", "args_", "._", "decrypt_", "==_", "config_", "[_", "'", "journal", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "update", "\\u", "config_", "(_", "original", "\\u", "config_", ",_", "{_", "\"", "encrypt", "\"_", ":_", "False_", "}_", ",_", "journal", "\\u", "name_", ",_", "force", "\\u", "local_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install_", "._", "save", "\\u", "config_", "(_", "original", "\\u", "config_", ",_", "config", "\\u", "path_", "=_", "CONFIG", "\\u", "PATH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "._", "edit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "config_", "[_", "'", "editor", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "util_", "._", "prompt_", "(_", "\"[", "You", " ", "need", " ", "to", " ", "speci", "fy", " ", "an", " ", "editor", " ", "in", " ", "{", "0", "}", " ", "to", " ", "use", " ", "the", " ", "--", "edit", " ", "function", ".]", "\"_", "._", "format_", "(_", "CONFIG", "\\u", "PATH_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "other", "\\u", "entries_", "=_", "[_", "e_", "for_", "e_", "in_", "old", "\\u", "entries_", "if_", "e_", "not_", "in_", "journal_", "._", "entries_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Edit_", "\\u\\u\\uNL\\u\\u\\u_", "old", "\\u", "num", "\\u", "entries_", "=_", "len_", "(_", "journal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edited", "_", "=_", "util_", "._", "get", "\\u", "text", "\\u", "from", "\\u", "editor_", "(_", "config_", ",_", "journal_", "._", "edita", "ble", "\\u", "str_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "journal_", "._", "parse", "\\u", "edita", "ble", "\\u", "str_", "(_", "edited", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "deleted_", "=_", "old", "\\u", "num", "\\u", "entries_", "-_", "len_", "(_", "journal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "edited", "_", "=_", "len_", "(_", "[_", "e_", "for_", "e_", "in_", "journal_", "._", "entries_", "if_", "e_", "._", "modified_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prompt", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "num", "\\u", "deleted_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prompt", "s_", "._", "append_", "(_", "\"{", "0", "}", " ", "{", "1", "}", " ", "delete", "d", "\"_", "._", "format_", "(_", "num", "\\u", "deleted_", ",_", "\"", "entry", "\"_", "if_", "num", "\\u", "deleted_", "==_", "1_", "else_", "\"", "entri", "es", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "num", "\\u", "edited", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prompt", "s_", "._", "append_", "(_", "\"{", "0", "}", " ", "{", "1", "}", " ", "modifi", "ed", "\"_", "._", "format_", "(_", "num", "\\u", "edited", "_", ",_", "\"", "entry", "\"_", "if_", "num", "\\u", "edited", "_", "==_", "1_", "else_", "\"", "entri", "es", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "prompt", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "util_", "._", "prompt_", "(_", "\"[{", "0", "}]\"_", "._", "format_", "(_", "\",", " ", "\"_", "._", "join_", "(_", "prompt", "s_", ")_", "._", "capitalize_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "journal_", "._", "entries_", "+=_", "other", "\\u", "entries_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "journal_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "journal_", "._", "write_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
cloudera/hue/desktop/core/ext-py/cx_Oracle-5.1.2/test/TestEnv.py
[ { "content": "\"\"\"Define test environment.\"\"\"\n\nimport cx_Oracle\nimport os\nimport sys\nimport unittest\n\n\nUSERNAME = GetValue(\"USERNAME\", \"user name\")\nPASSWORD = GetValue(\"PASSWORD\", \"password\")\nTNSENTRY = GetValue(\"TNSENTRY\", \"TNS entry\")\nARRAY_SIZE = int(GetValue(\"ARRAY_SIZE\", \"array size\"))\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def GetValue(name, label):\n value = os.environ.get(\"CX_ORACLE_\" + name)\n if value is None:\n value = raw_input(label + \": \")\n if hasattr(cx_Oracle, \"UNICODE\") or sys.version_info[0] >= 3:\n return value\n return unicode(value)", "metadata": "root.GetValue", "header": "['module', '___EOS___']", "index": 7 } ]
[ { "span": "import unittest", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 15 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Define", " ", "test", " ", "environ", "ment", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "cx", "\\u", "Ora", "cle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "USERNAME_", "=_", "Get", "Value_", "(_", "\"", "USER", "NAME", "\"_", ",_", "\"", "user", " ", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PASSWORD_", "=_", "Get", "Value_", "(_", "\"", "PASS", "WORD", "\"_", ",_", "\"", "password", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TN", "SENT", "RY_", "=_", "Get", "Value_", "(_", "\"", "TN", "SENT", "RY", "\"_", ",_", "\"", "TN", "S", " ", "entry", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ARR", "AY", "\\u", "SIZE_", "=_", "int_", "(_", "Get", "Value_", "(_", "\"", "ARR", "AY", "\\u", "SIZE", "\"_", ",_", "\"", "array", " ", "size", "\"_", ")_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Get", "Value_", "(_", "name_", ",_", "label_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "\"", "CX", "\\u", "ORA", "CLE", "\\u\"_", "+_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "raw", "\\u", "input_", "(_", "label_", "+_", "\":", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "cx", "\\u", "Ora", "cle_", ",_", "\"", "UNICODE", "\"_", ")_", "or_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", ">=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "unicode_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
RobotLocomotion/director/src/python/director/lcmloggerwidget.py
[ { "content": " def updateState(self):\n\n t = SimpleTimer()\n self.manager.updateExistingLoggerProcesses()\n\n activeLogFiles = self.manager.getActiveLogFilenames()\n self.numProcesses = len(self.manager.getActiveLoggerPids())\n self.numLogFiles = len(activeLogFiles)\n\n if self.numLogFiles == 1:\n self.lastActiveLogFile = activeLogFiles[0]\n\n if self.numProcesses == 0:\n self.button.text = 'start logger'\n elif self.numProcesses == 1:\n self.button.text = 'stop logger'\n elif self.numProcesses > 1:\n self.button.text = 'stop all loggers'\n\n statusDescription = 'active' if self.numProcesses else 'last'\n logFileDescription = self.lastActiveLogFile or '<unknown>'\n self.button.setToolTip('%s log file: %s' % (statusDescription, logFileDescription))", "metadata": "root.LCMLoggerWidget.updateState", "header": "['class', 'LCMLoggerWidget', '(', 'object', ')', ':', '___EOS___']", "index": 29 } ]
[ { "span": "t ", "start_line": 31, "start_column": 8, "end_line": 31, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "LC", "ML", "ogg", "er", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "State_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "Simple", "Timer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "manager_", "._", "update", "Exist", "ing", "Log", "ger", "Processe", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "active", "Log", "Files_", "=_", "self_", "._", "manager_", "._", "get", "Activ", "e", "Log", "File", "names_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "num", "Processe", "s_", "=_", "len_", "(_", "self_", "._", "manager_", "._", "get", "Activ", "e", "Log", "ger", "Pid", "s_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "num", "Log", "Files_", "=_", "len_", "(_", "active", "Log", "Files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "num", "Log", "Files_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "last", "Activ", "e", "Log", "File_", "=_", "active", "Log", "Files_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "num", "Processe", "s_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "button_", "._", "text_", "=_", "'", "start", " ", "logg", "er", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "num", "Processe", "s_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "button_", "._", "text_", "=_", "'", "stop", " ", "logg", "er", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "num", "Processe", "s_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "button_", "._", "text_", "=_", "'", "stop", " ", "all", " ", "logg", "ers", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "status", "Description_", "=_", "'", "active", "'_", "if_", "self_", "._", "num", "Processe", "s_", "else_", "'", "last", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "File", "Description_", "=_", "self_", "._", "last", "Activ", "e", "Log", "File_", "or_", "'<", "unknown", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "button_", "._", "set", "Tool", "Tip_", "(_", "'%", "s", " ", "log", " ", "file", ":", " ", "%", "s", "'_", "%_", "(_", "status", "Description_", ",_", "log", "File", "Description_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
enthought/traitsui/traitsui/qt4/tabular_editor.py
[ { "content": " def init (self, parent):\n \"\"\" Finishes initializing the editor by creating the underlying toolkit\n widget.\n \"\"\"\n factory = self.factory\n adapter = self.adapter = factory.adapter\n self.model = TabularModel(editor=self)\n\n # Create the control\n control = self.control = self.widget_factory(self)\n\n # Set up the selection listener\n if factory.multi_select:\n self.sync_value(factory.selected, 'multi_selected', 'both',\n is_list=True)\n self.sync_value(factory.selected_row, 'multi_selected_rows','both',\n is_list=True)\n else:\n self.sync_value(factory.selected, 'selected', 'both')\n self.sync_value(factory.selected_row, 'selected_row', 'both')\n\n # Connect to the mode specific selection handler\n if factory.multi_select:\n slot = self._on_rows_selection\n else:\n slot = self._on_row_selection\n signal = 'selectionChanged(QItemSelection,QItemSelection)'\n QtCore.QObject.connect(self.control.selectionModel(),\n QtCore.SIGNAL(signal), slot)\n\n # Synchronize other interesting traits as necessary:\n self.sync_value(factory.update, 'update', 'from')\n self.sync_value(factory.refresh, 'refresh', 'from')\n self.sync_value(factory.activated, 'activated', 'to')\n self.sync_value(factory.activated_row, 'activated_row', 'to')\n self.sync_value(factory.clicked, 'clicked', 'to')\n self.sync_value(factory.dclicked, 'dclicked', 'to')\n self.sync_value(factory.right_clicked, 'right_clicked', 'to')\n self.sync_value(factory.right_dclicked, 'right_dclicked', 'to')\n self.sync_value(factory.column_clicked, 'column_clicked', 'to')\n self.sync_value(factory.column_right_clicked, 'column_right_clicked', 'to')\n self.sync_value(factory.scroll_to_row, 'scroll_to_row', 'from')\n\n # Connect other signals as necessary\n signal = QtCore.SIGNAL('activated(QModelIndex)')\n QtCore.QObject.connect(control, signal, self._on_activate)\n signal = QtCore.SIGNAL('clicked(QModelIndex)')\n QtCore.QObject.connect(control, signal, self._on_click)\n signal = QtCore.SIGNAL('clicked(QModelIndex)')\n QtCore.QObject.connect(control, signal, self._on_right_click)\n signal = QtCore.SIGNAL('doubleClicked(QModelIndex)')\n QtCore.QObject.connect(control, signal, self._on_dclick)\n signal = QtCore.SIGNAL('sectionClicked(int)')\n QtCore.QObject.connect(control.horizontalHeader(), signal, self._on_column_click)\n\n control.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)\n signal = QtCore.SIGNAL('customContextMenuRequested(QPoint)')\n QtCore.QObject.connect(control, signal, self._on_context_menu)\n\n self.header_event_filter = HeaderEventFilter(self)\n control.horizontalHeader().installEventFilter(self.header_event_filter)\n\n # Make sure we listen for 'items' changes as well as complete list\n # replacements:\n try:\n self.context_object.on_trait_change(\n self.update_editor, self.extended_name+'_items', dispatch='ui')\n except:\n pass\n\n # If the user has requested automatic update, attempt to set up the\n # appropriate listeners:\n if factory.auto_update:\n self.context_object.on_trait_change(\n self.refresh_editor, self.extended_name + '.-', dispatch='ui')\n\n # Create the mapping from user supplied images to QImages:\n for image_resource in factory.images:\n self._add_image(image_resource)\n\n # Refresh the editor whenever the adapter changes:\n self.on_trait_change(self.refresh_editor, 'adapter.+update',\n dispatch='ui')\n\n # Rebuild the editor columns and headers whenever the adapter's\n # 'columns' changes:\n self.on_trait_change(self.update_editor, 'adapter.columns',\n dispatch='ui')", "metadata": "root.TabularEditor.init", "header": "['class', 'TabularEditor', '(', 'Editor', ')', ':', '___EOS___']", "index": 136 } ]
[ { "span": "adapter ", "start_line": 141, "start_column": 8, "end_line": 141, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Tab", "ular", "Editor_", "(_", "Editor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "init_", "(_", "self_", ",_", "parent_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Finish", "es", " ", "initiali", "zin", "g", " ", "the", " ", "editor", " ", "by", " ", "creati", "ng", " ", "the", " ", "underl", "ying", " ", "tool", "kit", "\\", "10", ";", " ", " ", " ", " ", "widget", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "factory_", "=_", "self_", "._", "factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "adapter_", "=_", "self_", "._", "adapter_", "=_", "factory_", "._", "adapter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "model_", "=_", "Tab", "ular", "Model_", "(_", "editor_", "=_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "control_", "\\u\\u\\uNL\\u\\u\\u_", "control_", "=_", "self_", "._", "control_", "=_", "self_", "._", "widget", "\\u", "factory_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "up", " ", "the", " ", "selection", " ", "listener_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "factory_", "._", "multi", "\\u", "select_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sync", "\\u", "value_", "(_", "factory_", "._", "selected_", ",_", "'", "multi", "\\u", "selecte", "d", "'_", ",_", "'", "bot", "h", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "list_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sync", "\\u", "value_", "(_", "factory_", "._", "selecte", "d\\u", "row_", ",_", "'", "multi", "\\u", "selecte", "d\\u", "rows", "'_", ",_", "'", "bot", "h", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "list_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sync", "\\u", "value_", "(_", "factory_", "._", "selected_", ",_", "'", "selecte", "d", "'_", ",_", "'", "bot", "h", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sync", "\\u", "value_", "(_", "factory_", "._", "selecte", "d\\u", "row_", ",_", "'", "selecte", "d\\u", "row", "'_", ",_", "'", "bot", "h", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Connect", " ", "to", " ", "the", " ", "mode", " ", "specific", " ", "selection", " ", "handler_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "factory_", "._", "multi", "\\u", "select_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slot_", "=_", "self_", "._", "\\u", "on", "\\u", "rows", "\\u", "selection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slot_", "=_", "self_", "._", "\\u", "on", "\\u", "row", "\\u", "selection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "signal_", "=_", "'", "selection", "Change", "d", "(", "QI", "tem", "Selecti", "on", ",", "QI", "tem", "Selecti", "on", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Qt", "Core_", "._", "QO", "bject_", "._", "connect_", "(_", "self_", "._", "control_", "._", "selection", "Model_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Qt", "Core_", "._", "SIGNAL_", "(_", "signal_", ")_", ",_", "slot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Synchronize", " ", "other", " ", "interesting", " ", "traits", " ", "as", " ", "necessar", "y", ":_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "sync", "\\u", "value_", "(_", "factory_", "._", "update_", ",_", "'", "update", "'_", ",_", "'", "from", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sync", "\\u", "value_", "(_", "factory_", "._", "refresh_", ",_", "'", "refre", "sh", "'_", ",_", "'", "from", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sync", "\\u", "value_", "(_", "factory_", "._", "activated_", ",_", "'", "activat", "ed", "'_", ",_", "'", "to", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sync", "\\u", "value_", "(_", "factory_", "._", "activat", "ed", "\\u", "row_", ",_", "'", "activat", "ed", "\\u", "row", "'_", ",_", "'", "to", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sync", "\\u", "value_", "(_", "factory_", "._", "clicked_", ",_", "'", "click", "ed", "'_", ",_", "'", "to", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sync", "\\u", "value_", "(_", "factory_", "._", "dcl", "ick", "ed_", ",_", "'", "dcl", "ick", "ed", "'_", ",_", "'", "to", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sync", "\\u", "value_", "(_", "factory_", "._", "right", "\\u", "clicked_", ",_", "'", "right", "\\u", "click", "ed", "'_", ",_", "'", "to", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sync", "\\u", "value_", "(_", "factory_", "._", "right", "\\u", "dcl", "ick", "ed_", ",_", "'", "right", "\\u", "dcl", "ick", "ed", "'_", ",_", "'", "to", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sync", "\\u", "value_", "(_", "factory_", "._", "column", "\\u", "clicked_", ",_", "'", "column", "\\u", "click", "ed", "'_", ",_", "'", "to", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sync", "\\u", "value_", "(_", "factory_", "._", "column", "\\u", "right", "\\u", "clicked_", ",_", "'", "column", "\\u", "right", "\\u", "click", "ed", "'_", ",_", "'", "to", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sync", "\\u", "value_", "(_", "factory_", "._", "scroll", "\\u", "to", "\\u", "row_", ",_", "'", "scroll", "\\u", "to", "\\u", "row", "'_", ",_", "'", "from", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Connect", " ", "other", " ", "signal", "s", " ", "as", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "signal_", "=_", "Qt", "Core_", "._", "SIGNAL_", "(_", "'", "activat", "ed", "(", "QM", "odel", "Index", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Qt", "Core_", "._", "QO", "bject_", "._", "connect_", "(_", "control_", ",_", "signal_", ",_", "self_", "._", "\\u", "on", "\\u", "activate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signal_", "=_", "Qt", "Core_", "._", "SIGNAL_", "(_", "'", "click", "ed", "(", "QM", "odel", "Index", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Qt", "Core_", "._", "QO", "bject_", "._", "connect_", "(_", "control_", ",_", "signal_", ",_", "self_", "._", "\\u", "on", "\\u", "click_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signal_", "=_", "Qt", "Core_", "._", "SIGNAL_", "(_", "'", "click", "ed", "(", "QM", "odel", "Index", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Qt", "Core_", "._", "QO", "bject_", "._", "connect_", "(_", "control_", ",_", "signal_", ",_", "self_", "._", "\\u", "on", "\\u", "right", "\\u", "click_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signal_", "=_", "Qt", "Core_", "._", "SIGNAL_", "(_", "'", "double", "Click", "ed", "(", "QM", "odel", "Index", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Qt", "Core_", "._", "QO", "bject_", "._", "connect_", "(_", "control_", ",_", "signal_", ",_", "self_", "._", "\\u", "on", "\\u", "dcl", "ick", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signal_", "=_", "Qt", "Core_", "._", "SIGNAL_", "(_", "'", "section", "Click", "ed", "(", "int", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Qt", "Core_", "._", "QO", "bject_", "._", "connect_", "(_", "control_", "._", "horizon", "tal", "Header_", "(_", ")_", ",_", "signal_", ",_", "self_", "._", "\\u", "on", "\\u", "column", "\\u", "click_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "control_", "._", "set", "Context", "Menu", "Policy_", "(_", "Qt", "Core_", "._", "Qt_", "._", "Custom", "Context", "Menu_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signal_", "=_", "Qt", "Core_", "._", "SIGNAL_", "(_", "'", "custom", "Context", "Menu", "Requeste", "d", "(", "QP", "oint", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Qt", "Core_", "._", "QO", "bject_", "._", "connect_", "(_", "control_", ",_", "signal_", ",_", "self_", "._", "\\u", "on", "\\u", "context", "\\u", "menu_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "header", "\\u", "event", "\\u", "filter_", "=_", "Head", "er", "Event", "Filter_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "control_", "._", "horizon", "tal", "Header_", "(_", ")_", "._", "install", "Event", "Filter_", "(_", "self_", "._", "header", "\\u", "event", "\\u", "filter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "we", " ", "listen", " ", "for", " ", "'", "items", "'", " ", "change", "s", " ", "as", " ", "well", " ", "as", " ", "complete", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "replace", "ment", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "context", "\\u", "object_", "._", "on", "\\u", "tra", "it", "\\u", "change_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "update", "\\u", "editor_", ",_", "self_", "._", "extend", "ed", "\\u", "name_", "+_", "'\\u", "items", "'_", ",_", "dispatch_", "=_", "'", "ui", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "user", " ", "has", " ", "request", "ed", " ", "automati", "c", " ", "update", ",", " ", "atte", "mpt", " ", "to", " ", "set", " ", "up", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "appropr", "iate", " ", "listeners", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "factory_", "._", "auto", "\\u", "update_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "context", "\\u", "object_", "._", "on", "\\u", "tra", "it", "\\u", "change_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "refre", "sh", "\\u", "editor_", ",_", "self_", "._", "extend", "ed", "\\u", "name_", "+_", "'.", "-'_", ",_", "dispatch_", "=_", "'", "ui", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "mapping", " ", "from", " ", "user", " ", "supplie", "d", " ", "images", " ", "to", " ", "QI", "mage", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "image", "\\u", "resource_", "in_", "factory_", "._", "images_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "add", "\\u", "image_", "(_", "image", "\\u", "resource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Refr", "esh", " ", "the", " ", "editor", " ", "whe", "neve", "r", " ", "the", " ", "adapter", " ", "change", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "on", "\\u", "tra", "it", "\\u", "change_", "(_", "self_", "._", "refre", "sh", "\\u", "editor_", ",_", "'", "adapter", ".+", "update", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dispatch_", "=_", "'", "ui", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Reb", "uild", " ", "the", " ", "editor", " ", "column", "s", " ", "and", " ", "header", "s", " ", "whe", "neve", "r", " ", "the", " ", "adapter", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "column", "s", "'", " ", "change", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "on", "\\u", "tra", "it", "\\u", "change_", "(_", "self_", "._", "update", "\\u", "editor_", ",_", "'", "adapter", ".", "column", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dispatch_", "=_", "'", "ui", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ImageEngine/gaffer/python/GafferImageTest/__init__.py
[ { "content": "##########################################################################\n#\n# Copyright (c) 2012, John Haddon. All rights reserved.\n# Copyright (c) 2013-2015, Image Engine Design Inc. All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n# * Redistributions of source code must retain the above\n# copyright notice, this list of conditions and the following\n# disclaimer.\n#\n# * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following\n# disclaimer in the documentation and/or other materials provided with\n# the distribution.\n#\n# * Neither the name of John Haddon nor the names of\n# any other contributors to this software may be used to endorse or\n# promote products derived from this software without specific prior\n# written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS\n# IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n#\n##########################################################################\n\nfrom _GafferImageTest import *\n\nfrom ImageTestCase import ImageTestCase\nfrom ImagePlugTest import ImagePlugTest\nfrom OpenImageIOReaderTest import OpenImageIOReaderTest\nfrom ImageReaderTest import ImageReaderTest\nfrom ColorSpaceTest import ColorSpaceTest\nfrom ObjectToImageTest import ObjectToImageTest\nfrom FormatTest import FormatTest\nfrom AtomicFormatPlugTest import AtomicFormatPlugTest\nfrom MergeTest import MergeTest\nfrom GradeTest import GradeTest\nfrom ConstantTest import ConstantTest\nfrom ImageWriterTest import ImageWriterTest\nfrom ChannelMaskPlugTest import ChannelMaskPlugTest\nfrom SamplerTest import SamplerTest\nfrom DisplayTest import DisplayTest\nfrom ImageStatsTest import ImageStatsTest\nfrom ImageTransformTest import ImageTransformTest\nfrom DeleteChannelsTest import DeleteChannelsTest\nfrom ClampTest import ClampTest\nfrom ImageSwitchTest import ImageSwitchTest\nfrom ImageTimeWarpTest import ImageTimeWarpTest\nfrom ImageSamplerTest import ImageSamplerTest\nfrom ImageNodeTest import ImageNodeTest\nfrom FormatDataTest import FormatDataTest\nfrom ImageMetadataTest import ImageMetadataTest\nfrom DeleteImageMetadataTest import DeleteImageMetadataTest\nfrom CopyImageMetadataTest import CopyImageMetadataTest\nfrom ImageLoopTest import ImageLoopTest\nfrom ImageProcessorTest import ImageProcessorTest\nfrom ShuffleTest import ShuffleTest\nfrom PremultiplyTest import PremultiplyTest\nfrom UnpremultiplyTest import UnpremultiplyTest\nfrom CropTest import CropTest\nfrom ResampleTest import ResampleTest\nfrom ResizeTest import ResizeTest\nfrom LUTTest import LUTTest\nfrom CDLTest import CDLTest\nfrom ImageAlgoTest import ImageAlgoTest\nfrom BufferAlgoTest import BufferAlgoTest\nfrom DisplayTransformTest import DisplayTransformTest\nfrom FormatPlugTest import FormatPlugTest\nfrom OffsetTest import OffsetTest\nfrom BlurTest import BlurTest\nfrom TextTest import TextTest\nfrom OpenColorIOTransformTest import OpenColorIOTransformTest\nfrom UVWarpTest import UVWarpTest\n\nif __name__ == \"__main__\":\n\timport unittest\n\tunittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from ImageTestCase import ImageTestCase", "start_line": 39, "start_column": 0, "end_line": 39, "end_column": 39 }, { "span": "from ImagePlugTest import ImagePlugTest", "start_line": 40, "start_column": 0, "end_line": 40, "end_column": 39 }, { "span": "from OpenImageIOReaderTest import OpenImageIOReaderTest", "start_line": 41, "start_column": 0, "end_line": 41, "end_column": 55 }, { "span": "from ImageReaderTest import ImageReaderTest", "start_line": 42, "start_column": 0, "end_line": 42, "end_column": 43 }, { "span": "from ColorSpaceTest import ColorSpaceTest", "start_line": 43, "start_column": 0, "end_line": 43, "end_column": 41 }, { "span": "from ObjectToImageTest import ObjectToImageTest", "start_line": 44, "start_column": 0, "end_line": 44, "end_column": 47 }, { "span": "from FormatTest import FormatTest", "start_line": 45, "start_column": 0, "end_line": 45, "end_column": 33 }, { "span": "from AtomicFormatPlugTest import AtomicFormatPlugTest", "start_line": 46, "start_column": 0, "end_line": 46, "end_column": 53 }, { "span": "from MergeTest import MergeTest", "start_line": 47, "start_column": 0, "end_line": 47, "end_column": 31 }, { "span": "from GradeTest import GradeTest", "start_line": 48, "start_column": 0, "end_line": 48, "end_column": 31 }, { "span": "from ConstantTest import ConstantTest", "start_line": 49, "start_column": 0, "end_line": 49, "end_column": 37 }, { "span": "from ImageWriterTest import ImageWriterTest", "start_line": 50, "start_column": 0, "end_line": 50, "end_column": 43 }, { "span": "from ChannelMaskPlugTest import ChannelMaskPlugTest", "start_line": 51, "start_column": 0, "end_line": 51, "end_column": 51 }, { "span": "from SamplerTest import SamplerTest", "start_line": 52, "start_column": 0, "end_line": 52, "end_column": 35 }, { "span": "from DisplayTest import DisplayTest", "start_line": 53, "start_column": 0, "end_line": 53, "end_column": 35 }, { "span": "from ImageStatsTest import ImageStatsTest", "start_line": 54, "start_column": 0, "end_line": 54, "end_column": 41 }, { "span": "from ImageTransformTest import ImageTransformTest", "start_line": 55, "start_column": 0, "end_line": 55, "end_column": 49 }, { "span": "from DeleteChannelsTest import DeleteChannelsTest", "start_line": 56, "start_column": 0, "end_line": 56, "end_column": 49 }, { "span": "from ClampTest import ClampTest", "start_line": 57, "start_column": 0, "end_line": 57, "end_column": 31 }, { "span": "from ImageSwitchTest import ImageSwitchTest", "start_line": 58, "start_column": 0, "end_line": 58, "end_column": 43 }, { "span": "from ImageTimeWarpTest import ImageTimeWarpTest", "start_line": 59, "start_column": 0, "end_line": 59, "end_column": 47 }, { "span": "from ImageSamplerTest import ImageSamplerTest", "start_line": 60, "start_column": 0, "end_line": 60, "end_column": 45 }, { "span": "from ImageNodeTest import ImageNodeTest", "start_line": 61, "start_column": 0, "end_line": 61, "end_column": 39 }, { "span": "from FormatDataTest import FormatDataTest", "start_line": 62, "start_column": 0, "end_line": 62, "end_column": 41 }, { "span": "from ImageMetadataTest import ImageMetadataTest", "start_line": 63, "start_column": 0, "end_line": 63, "end_column": 47 }, { "span": "from DeleteImageMetadataTest import DeleteImageMetadataTest", "start_line": 64, "start_column": 0, "end_line": 64, "end_column": 59 }, { "span": "from CopyImageMetadataTest import CopyImageMetadataTest", "start_line": 65, "start_column": 0, "end_line": 65, "end_column": 55 }, { "span": "from ImageLoopTest import ImageLoopTest", "start_line": 66, "start_column": 0, "end_line": 66, "end_column": 39 }, { "span": "from ImageProcessorTest import ImageProcessorTest", "start_line": 67, "start_column": 0, "end_line": 67, "end_column": 49 }, { "span": "from ShuffleTest import ShuffleTest", "start_line": 68, "start_column": 0, "end_line": 68, "end_column": 35 }, { "span": "from PremultiplyTest import PremultiplyTest", "start_line": 69, "start_column": 0, "end_line": 69, "end_column": 43 }, { "span": "from UnpremultiplyTest import UnpremultiplyTest", "start_line": 70, "start_column": 0, "end_line": 70, "end_column": 47 }, { "span": "from CropTest import CropTest", "start_line": 71, "start_column": 0, "end_line": 71, "end_column": 29 }, { "span": "from ResampleTest import ResampleTest", "start_line": 72, "start_column": 0, "end_line": 72, "end_column": 37 }, { "span": "from ResizeTest import ResizeTest", "start_line": 73, "start_column": 0, "end_line": 73, "end_column": 33 }, { "span": "from LUTTest import LUTTest", "start_line": 74, "start_column": 0, "end_line": 74, "end_column": 27 }, { "span": "from CDLTest import CDLTest", "start_line": 75, "start_column": 0, "end_line": 75, "end_column": 27 }, { "span": "from ImageAlgoTest import ImageAlgoTest", "start_line": 76, "start_column": 0, "end_line": 76, "end_column": 39 }, { "span": "from BufferAlgoTest import BufferAlgoTest", "start_line": 77, "start_column": 0, "end_line": 77, "end_column": 41 }, { "span": "from DisplayTransformTest import DisplayTransformTest", "start_line": 78, "start_column": 0, "end_line": 78, "end_column": 53 }, { "span": "from FormatPlugTest import FormatPlugTest", "start_line": 79, "start_column": 0, "end_line": 79, "end_column": 41 }, { "span": "from OffsetTest import OffsetTest", "start_line": 80, "start_column": 0, "end_line": 80, "end_column": 33 }, { "span": "from BlurTest import BlurTest", "start_line": 81, "start_column": 0, "end_line": 81, "end_column": 29 }, { "span": "from TextTest import TextTest", "start_line": 82, "start_column": 0, "end_line": 82, "end_column": 29 }, { "span": "from OpenColorIOTransformTest import OpenColorIOTransformTest", "start_line": 83, "start_column": 0, "end_line": 83, "end_column": 61 }, { "span": "from UVWarpTest import UVWarpTest", "start_line": 84, "start_column": 0, "end_line": 84, "end_column": 33 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Copy", "right", " ", "(", "c", ")", " ", "2012", ",", " ", "Joh", "n", " ", "Had", "don", ".", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Copy", "right", " ", "(", "c", ")", " ", "2013", "-", "201", "5", ",", " ", "Image", " ", "Engine", " ", "Desig", "n", " ", "Inc", ".", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "copyr", "ight", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "following_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "copyr", "ight", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "following_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "discl", "aime", "r", " ", "in", " ", "the", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "Joh", "n", " ", "Had", "don", " ", "nor", " ", "the", " ", "names", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "any", " ", "other", " ", "contributor", "s", " ", "to", " ", "this", " ", "software", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "promote", " ", "products", " ", "derive", "d", " ", "from", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "writt", "en", " ", "permissi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS", " ", "\"", "AS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "IS", "\"", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "THE", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "PUR", "POS", "E", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "OWNER", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u", "Ga", "ffer", "Image", "Test_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "Image", "Test", "Case_", "import_", "Image", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Image", "Plug", "Test_", "import_", "Image", "Plug", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Open", "Image", "IO", "Read", "er", "Test_", "import_", "Open", "Image", "IO", "Read", "er", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Image", "Read", "er", "Test_", "import_", "Image", "Read", "er", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Color", "Spac", "e", "Test_", "import_", "Color", "Spac", "e", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Object", "To", "Image", "Test_", "import_", "Object", "To", "Image", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Format", "Test_", "import_", "Format", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Atom", "ic", "Format", "Plug", "Test_", "import_", "Atom", "ic", "Format", "Plug", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Merge", "Test_", "import_", "Merge", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Grade", "Test_", "import_", "Grade", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Const", "ant", "Test_", "import_", "Const", "ant", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Image", "Write", "r", "Test_", "import_", "Image", "Write", "r", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Chan", "nel", "Mask", "Plug", "Test_", "import_", "Chan", "nel", "Mask", "Plug", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Sampler", "Test_", "import_", "Sampler", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Display", "Test_", "import_", "Display", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Image", "Stat", "s", "Test_", "import_", "Image", "Stat", "s", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Image", "Transform", "Test_", "import_", "Image", "Transform", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Delete", "Chan", "nels", "Test_", "import_", "Delete", "Chan", "nels", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Cla", "mp", "Test_", "import_", "Cla", "mp", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Image", "Switch", "Test_", "import_", "Image", "Switch", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Image", "Time", "War", "p", "Test_", "import_", "Image", "Time", "War", "p", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Image", "Sampler", "Test_", "import_", "Image", "Sampler", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Image", "Node", "Test_", "import_", "Image", "Node", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Format", "Data", "Test_", "import_", "Format", "Data", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Image", "Meta", "data", "Test_", "import_", "Image", "Meta", "data", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Delete", "Image", "Meta", "data", "Test_", "import_", "Delete", "Image", "Meta", "data", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Copy", "Image", "Meta", "data", "Test_", "import_", "Copy", "Image", "Meta", "data", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Image", "Loop", "Test_", "import_", "Image", "Loop", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Image", "Process", "or", "Test_", "import_", "Image", "Process", "or", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Shuffle", "Test_", "import_", "Shuffle", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Prem", "ulti", "ply", "Test_", "import_", "Prem", "ulti", "ply", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Unp", "rem", "ulti", "ply", "Test_", "import_", "Unp", "rem", "ulti", "ply", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Cro", "p", "Test_", "import_", "Cro", "p", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Res", "ample", "Test_", "import_", "Res", "ample", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Resize", "Test_", "import_", "Resize", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "LUT", "Test_", "import_", "LUT", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "CD", "LT", "est_", "import_", "CD", "LT", "est_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Image", "Algo", "Test_", "import_", "Image", "Algo", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Buffer", "Algo", "Test_", "import_", "Buffer", "Algo", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Display", "Transform", "Test_", "import_", "Display", "Transform", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Format", "Plug", "Test_", "import_", "Format", "Plug", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Off", "set", "Test_", "import_", "Off", "set", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Blur", "Test_", "import_", "Blur", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Text", "Test_", "import_", "Text", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Open", "Color", "IO", "Transform", "Test_", "import_", "Open", "Color", "IO", "Transform", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "UV", "War", "p", "Test_", "import_", "UV", "War", "p", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
zain/jogging/jogging/tests/urls.py
[ { "content": "#:coding=utf-8:\nfrom django.conf.urls.defaults import *\nfrom django.conf import settings\n\nurlpatterns = patterns('',\n (r'exception_view', 'jogging.tests.views.exception_view'),\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from django.conf import settings", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 32 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", ":", "codi", "ng", "=", "utf", "-", "8", ":_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "conf_", "._", "urls_", "._", "defaults_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "urlpatterns_", "=_", "patterns_", "(_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'", "exception", "\\u", "view", "'_", ",_", "'", "jog", "ging", ".", "tests", ".", "views", ".", "exception", "\\u", "view", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unreachable code
giampaolo/psutil/psutil/tests/test_linux.py
[ { "content": " def test_net_connections_mocked(self):\n def open_mock(name, *args, **kwargs):\n if name == '/proc/net/unix':\n return io.StringIO(textwrap.dedent(u\"\"\"\\\n 0: 00000003 000 000 0001 03 462170 @/tmp/dbus-Qw2hMPIU3n\n 0: 00000003 000 000 0001 03 35010 @/tmp/dbus-tB2X8h69BQ\n 0: 00000003 000 000 0001 03 34424 @/tmp/dbus-cHy80Y8O\n 000000000000000000000000000000000000000000000000000000\n \"\"\"))\n else:\n return orig_open(name, *args, **kwargs)\n return orig_open(name, *args)\n\n orig_open = open\n patch_point = 'builtins.open' if PY3 else '__builtin__.open'\n with mock.patch(patch_point, side_effect=open_mock) as m:\n psutil.net_connections(kind='unix')\n assert m.called", "metadata": "root.TestSystemNetwork.test_net_connections_mocked", "header": "['class', 'TestSystemNetwork', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 415 }, { "content": " def test_disk_io_counters_kernel_2_4_mocked(self):\n # Tests /proc/diskstats parsing format for 2.4 kernels, see:\n # https://github.com/giampaolo/psutil/issues/767\n def open_mock(name, *args, **kwargs):\n if name == '/proc/partitions':\n return io.StringIO(textwrap.dedent(u\"\"\"\\\n major minor #blocks name\n\n 8 0 488386584 hda\n \"\"\"))\n elif name == '/proc/diskstats':\n return io.StringIO(\n u(\" 3 0 1 hda 2 3 4 5 6 7 8 9 10 11 12\"))\n else:\n return orig_open(name, *args, **kwargs)\n return orig_open(name, *args)\n\n orig_open = open\n patch_point = 'builtins.open' if PY3 else '__builtin__.open'\n with mock.patch(patch_point, side_effect=open_mock) as m:\n ret = psutil.disk_io_counters()\n assert m.called\n self.assertEqual(ret.read_count, 1)\n self.assertEqual(ret.read_merged_count, 2)\n self.assertEqual(ret.read_bytes, 3 * SECTOR_SIZE)\n self.assertEqual(ret.read_time, 4)\n self.assertEqual(ret.write_count, 5)\n self.assertEqual(ret.write_merged_count, 6)\n self.assertEqual(ret.write_bytes, 7 * SECTOR_SIZE)\n self.assertEqual(ret.write_time, 8)\n self.assertEqual(ret.busy_time, 10)", "metadata": "root.TestSystemDisks.test_disk_io_counters_kernel_2_4_mocked", "header": "['class', 'TestSystemDisks', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 493 }, { "content": " def test_disk_io_counters_kernel_2_6_full_mocked(self):\n # Tests /proc/diskstats parsing format for 2.6 kernels,\n # lines reporting all metrics:\n # https://github.com/giampaolo/psutil/issues/767\n def open_mock(name, *args, **kwargs):\n if name == '/proc/partitions':\n return io.StringIO(textwrap.dedent(u\"\"\"\\\n major minor #blocks name\n\n 8 0 488386584 hda\n \"\"\"))\n elif name == '/proc/diskstats':\n return io.StringIO(\n u(\" 3 0 hda 1 2 3 4 5 6 7 8 9 10 11\"))\n else:\n return orig_open(name, *args, **kwargs)\n return orig_open(name, *args)\n\n orig_open = open\n patch_point = 'builtins.open' if PY3 else '__builtin__.open'\n with mock.patch(patch_point, side_effect=open_mock) as m:\n ret = psutil.disk_io_counters()\n assert m.called\n self.assertEqual(ret.read_count, 1)\n self.assertEqual(ret.read_merged_count, 2)\n self.assertEqual(ret.read_bytes, 3 * SECTOR_SIZE)\n self.assertEqual(ret.read_time, 4)\n self.assertEqual(ret.write_count, 5)\n self.assertEqual(ret.write_merged_count, 6)\n self.assertEqual(ret.write_bytes, 7 * SECTOR_SIZE)\n self.assertEqual(ret.write_time, 8)\n self.assertEqual(ret.busy_time, 10)", "metadata": "root.TestSystemDisks.test_disk_io_counters_kernel_2_6_full_mocked", "header": "['class', 'TestSystemDisks', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 525 }, { "content": " def test_disk_io_counters_kernel_2_6_limited_mocked(self):\n # Tests /proc/diskstats parsing format for 2.6 kernels,\n # where one line of /proc/partitions return a limited\n # amount of metrics when it bumps into a partition\n # (instead of a disk). See:\n # https://github.com/giampaolo/psutil/issues/767\n def open_mock(name, *args, **kwargs):\n if name == '/proc/partitions':\n return io.StringIO(textwrap.dedent(u\"\"\"\\\n major minor #blocks name\n\n 8 0 488386584 hda\n \"\"\"))\n elif name == '/proc/diskstats':\n return io.StringIO(\n u(\" 3 1 hda 1 2 3 4\"))\n else:\n return orig_open(name, *args, **kwargs)\n return orig_open(name, *args)\n\n orig_open = open\n patch_point = 'builtins.open' if PY3 else '__builtin__.open'\n with mock.patch(patch_point, side_effect=open_mock) as m:\n ret = psutil.disk_io_counters()\n assert m.called\n self.assertEqual(ret.read_count, 1)\n self.assertEqual(ret.read_bytes, 2 * SECTOR_SIZE)\n self.assertEqual(ret.write_count, 3)\n self.assertEqual(ret.write_bytes, 4 * SECTOR_SIZE)\n\n self.assertEqual(ret.read_merged_count, 0)\n self.assertEqual(ret.read_time, 0)\n self.assertEqual(ret.write_merged_count, 0)\n self.assertEqual(ret.write_time, 0)\n self.assertEqual(ret.busy_time, 0)", "metadata": "root.TestSystemDisks.test_disk_io_counters_kernel_2_6_limited_mocked", "header": "['class', 'TestSystemDisks', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 558 }, { "content": " @unittest.skipIf(PYPY, \"skipped on PYPY\")\n def test_open_files_mode(self):\n def get_test_file():\n p = psutil.Process()\n giveup_at = time.time() + 2\n while True:\n for file in p.open_files():\n if file.path == os.path.abspath(TESTFN):\n return file\n elif time.time() > giveup_at:\n break\n raise RuntimeError(\"timeout looking for test file\")\n\n #\n with open(TESTFN, \"w\"):\n self.assertEqual(get_test_file().mode, \"w\")\n with open(TESTFN, \"r\"):\n self.assertEqual(get_test_file().mode, \"r\")\n with open(TESTFN, \"a\"):\n self.assertEqual(get_test_file().mode, \"a\")\n #\n with open(TESTFN, \"r+\"):\n self.assertEqual(get_test_file().mode, \"r+\")\n with open(TESTFN, \"w+\"):\n self.assertEqual(get_test_file().mode, \"r+\")\n with open(TESTFN, \"a+\"):\n self.assertEqual(get_test_file().mode, \"a+\")\n # note: \"x\" bit is not supported\n if PY3:\n safe_remove(TESTFN)\n with open(TESTFN, \"x\"):\n self.assertEqual(get_test_file().mode, \"w\")\n safe_remove(TESTFN)\n with open(TESTFN, \"x+\"):\n self.assertEqual(get_test_file().mode, \"r+\")", "metadata": "root.TestProcess.test_open_files_mode", "header": "['class', 'TestProcess', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 829 } ]
[ { "span": "return orig_open(name, *args)", "start_line": 426, "start_column": 12, "end_line": 426, "end_column": 41 }, { "span": "return orig_open(name, *args)", "start_line": 508, "start_column": 12, "end_line": 508, "end_column": 41 }, { "span": "return orig_open(name, *args)", "start_line": 541, "start_column": 12, "end_line": 541, "end_column": 41 }, { "span": "return orig_open(name, *args)", "start_line": 576, "start_column": 12, "end_line": 576, "end_column": 41 }, { "span": "raise RuntimeError(\"timeout looking for test file\")", "start_line": 840, "start_column": 12, "end_line": 840, "end_column": 63 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Test", "System", "Network_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "net", "\\u", "connections", "\\u", "mocked", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "open", "\\u", "mock_", "(_", "name_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "==_", "'/", "proc", "/", "net", "/", "unix", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "io_", "._", "String", "IO_", "(_", "textwrap_", "._", "dedent_", "(_", "u", "\"\"\"", "\\\\", "\\", "10", ";", " ", " ", "0", ":", " ", "0000000", "3", " ", "000", " ", "000", " ", "0001", " ", "03", " ", "462", "170", " ", "@", "/", "tmp", "/", "dbus", "-", "Q", "w2", "h", "MPI", "U3", "n", "\\", "10", ";", " ", " ", "0", ":", " ", "0000000", "3", " ", "000", " ", "000", " ", "0001", " ", "03", " ", "350", "10", " ", "@", "/", "tmp", "/", "dbus", "-", "t", "B2", "X", "8", "h", "6", "9", "BQ", "\\", "10", ";", " ", " ", "0", ":", " ", "0000000", "3", " ", "000", " ", "000", " ", "0001", " ", "03", " ", "344", "24", " ", "@", "/", "tmp", "/", "dbus", "-", "c", "Hy", "80", "Y", "8", "O", "\\", "10", ";", " ", " ", "0000000000000", "0000000000000", "0000000000000", "0000000000000", "00", "\\", "10", ";", " ", " ", "\"\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "orig", "\\u", "open_", "(_", "name_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "orig", "\\u", "open_", "(_", "name_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "orig", "\\u", "open_", "=_", "open_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patch", "\\u", "point_", "=_", "'", "bui", "lti", "ns", ".", "open", "'_", "if_", "PY", "3_", "else_", "'\\u", "\\u", "bui", "lti", "n", "\\u\\u", ".", "open", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "mock_", "._", "patch_", "(_", "patch", "\\u", "point_", ",_", "side", "\\u", "effect_", "=_", "open", "\\u", "mock_", ")_", "as_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "psutil_", "._", "net", "\\u", "connections_", "(_", "kind_", "=_", "'", "unix", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "m_", "._", "called_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "System", "Disk", "s_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "disk", "\\u", "io", "\\u", "counter", "s", "\\u", "kernel", "\\u", "2", "\\u", "4", "\\u", "mocked", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", "s", " ", "/", "proc", "/", "disks", "tats", " ", "pars", "ing", " ", "format", " ", "for", " ", "2.4", " ", "kernels", ",", " ", "see", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "git", "hub", ".", "com", "/", "gia", "mpa", "olo", "/", "psu", "til", "/", "issue", "s", "/", "767", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "open", "\\u", "mock_", "(_", "name_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "==_", "'/", "proc", "/", "partit", "ion", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "io_", "._", "String", "IO_", "(_", "textwrap_", "._", "dedent_", "(_", "u", "\"\"\"", "\\\\", "\\", "10", ";", " ", " ", "major", " ", "mino", "r", " ", " ", "#", "blocks", " ", " ", "name", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "8", " ", " ", " ", " ", "0", " ", " ", "488", "386", "584", " ", "hda", "\\", "10", ";", " ", " ", "\"\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "name_", "==_", "'/", "proc", "/", "disks", "tats", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "io_", "._", "String", "IO_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "u_", "(_", "\"", " ", " ", " ", "3", " ", "0", " ", " ", " ", "1", " ", "hda", " ", "2", " ", "3", " ", "4", " ", "5", " ", "6", " ", "7", " ", "8", " ", "9", " ", "10", " ", "11", " ", "1", "2", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "orig", "\\u", "open_", "(_", "name_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "orig", "\\u", "open_", "(_", "name_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "orig", "\\u", "open_", "=_", "open_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patch", "\\u", "point_", "=_", "'", "bui", "lti", "ns", ".", "open", "'_", "if_", "PY", "3_", "else_", "'\\u", "\\u", "bui", "lti", "n", "\\u\\u", ".", "open", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "mock_", "._", "patch_", "(_", "patch", "\\u", "point_", ",_", "side", "\\u", "effect_", "=_", "open", "\\u", "mock_", ")_", "as_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "psutil_", "._", "disk", "\\u", "io", "\\u", "counters_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "m_", "._", "called_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "._", "read", "\\u", "count_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "._", "read", "\\u", "merge", "d\\u", "count_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "._", "read", "\\u", "bytes_", ",_", "3_", "*_", "SEC", "TOR", "\\u", "SIZE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "._", "read", "\\u", "time_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "._", "write", "\\u", "count_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "._", "write", "\\u", "merge", "d\\u", "count_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "._", "write", "\\u", "bytes_", ",_", "7_", "*_", "SEC", "TOR", "\\u", "SIZE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "._", "write", "\\u", "time_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "._", "bus", "y", "\\u", "time_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "System", "Disk", "s_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "disk", "\\u", "io", "\\u", "counter", "s", "\\u", "kernel", "\\u", "2", "\\u", "6", "\\u", "full", "\\u", "mocked", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", "s", " ", "/", "proc", "/", "disks", "tats", " ", "pars", "ing", " ", "format", " ", "for", " ", "2.6", " ", "kernels", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "lines", " ", "reporting", " ", "all", " ", "metric", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "git", "hub", ".", "com", "/", "gia", "mpa", "olo", "/", "psu", "til", "/", "issue", "s", "/", "767", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "open", "\\u", "mock_", "(_", "name_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "==_", "'/", "proc", "/", "partit", "ion", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "io_", "._", "String", "IO_", "(_", "textwrap_", "._", "dedent_", "(_", "u", "\"\"\"", "\\\\", "\\", "10", ";", " ", " ", "major", " ", "mino", "r", " ", " ", "#", "blocks", " ", " ", "name", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "8", " ", " ", " ", " ", "0", " ", " ", "488", "386", "584", " ", "hda", "\\", "10", ";", " ", " ", "\"\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "name_", "==_", "'/", "proc", "/", "disks", "tats", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "io_", "._", "String", "IO_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "u_", "(_", "\"", " ", " ", " ", "3", " ", " ", " ", " ", "0", " ", " ", " ", "hda", " ", "1", " ", "2", " ", "3", " ", "4", " ", "5", " ", "6", " ", "7", " ", "8", " ", "9", " ", "10", " ", "11", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "orig", "\\u", "open_", "(_", "name_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "orig", "\\u", "open_", "(_", "name_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "orig", "\\u", "open_", "=_", "open_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patch", "\\u", "point_", "=_", "'", "bui", "lti", "ns", ".", "open", "'_", "if_", "PY", "3_", "else_", "'\\u", "\\u", "bui", "lti", "n", "\\u\\u", ".", "open", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "mock_", "._", "patch_", "(_", "patch", "\\u", "point_", ",_", "side", "\\u", "effect_", "=_", "open", "\\u", "mock_", ")_", "as_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "psutil_", "._", "disk", "\\u", "io", "\\u", "counters_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "m_", "._", "called_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "._", "read", "\\u", "count_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "._", "read", "\\u", "merge", "d\\u", "count_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "._", "read", "\\u", "bytes_", ",_", "3_", "*_", "SEC", "TOR", "\\u", "SIZE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "._", "read", "\\u", "time_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "._", "write", "\\u", "count_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "._", "write", "\\u", "merge", "d\\u", "count_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "._", "write", "\\u", "bytes_", ",_", "7_", "*_", "SEC", "TOR", "\\u", "SIZE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "._", "write", "\\u", "time_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "._", "bus", "y", "\\u", "time_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "System", "Disk", "s_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "disk", "\\u", "io", "\\u", "counter", "s", "\\u", "kernel", "\\u", "2", "\\u", "6", "\\u", "limited", "\\u", "mocked", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", "s", " ", "/", "proc", "/", "disks", "tats", " ", "pars", "ing", " ", "format", " ", "for", " ", "2.6", " ", "kernels", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "where", " ", "one", " ", "line", " ", "of", " ", "/", "proc", "/", "partit", "ion", "s", " ", "return", " ", "a", " ", "limited", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "amo", "unt", " ", "of", " ", "metric", "s", " ", "whe", "n", " ", "it", " ", "bump", "s", " ", "int", "o", " ", "a", " ", "partition_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "inst", "ead", " ", "of", " ", "a", " ", "disk", ").", " ", "See", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "git", "hub", ".", "com", "/", "gia", "mpa", "olo", "/", "psu", "til", "/", "issue", "s", "/", "767", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "open", "\\u", "mock_", "(_", "name_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "==_", "'/", "proc", "/", "partit", "ion", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "io_", "._", "String", "IO_", "(_", "textwrap_", "._", "dedent_", "(_", "u", "\"\"\"", "\\\\", "\\", "10", ";", " ", " ", "major", " ", "mino", "r", " ", " ", "#", "blocks", " ", " ", "name", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "8", " ", " ", " ", " ", "0", " ", " ", "488", "386", "584", " ", "hda", "\\", "10", ";", " ", " ", "\"\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "name_", "==_", "'/", "proc", "/", "disks", "tats", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "io_", "._", "String", "IO_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "u_", "(_", "\"", " ", " ", " ", "3", " ", " ", " ", " ", "1", " ", " ", " ", "hda", " ", "1", " ", "2", " ", "3", " ", "4", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "orig", "\\u", "open_", "(_", "name_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "orig", "\\u", "open_", "(_", "name_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "orig", "\\u", "open_", "=_", "open_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patch", "\\u", "point_", "=_", "'", "bui", "lti", "ns", ".", "open", "'_", "if_", "PY", "3_", "else_", "'\\u", "\\u", "bui", "lti", "n", "\\u\\u", ".", "open", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "mock_", "._", "patch_", "(_", "patch", "\\u", "point_", ",_", "side", "\\u", "effect_", "=_", "open", "\\u", "mock_", ")_", "as_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "psutil_", "._", "disk", "\\u", "io", "\\u", "counters_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "m_", "._", "called_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "._", "read", "\\u", "count_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "._", "read", "\\u", "bytes_", ",_", "2_", "*_", "SEC", "TOR", "\\u", "SIZE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "._", "write", "\\u", "count_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "._", "write", "\\u", "bytes_", ",_", "4_", "*_", "SEC", "TOR", "\\u", "SIZE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "._", "read", "\\u", "merge", "d\\u", "count_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "._", "read", "\\u", "time_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "._", "write", "\\u", "merge", "d\\u", "count_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "._", "write", "\\u", "time_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "._", "bus", "y", "\\u", "time_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Process_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip", "If_", "(_", "PY", "PY", "_", ",_", "\"", "skip", "ped", " ", "on", " ", "PY", "PY", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "open", "\\u", "files", "\\u", "mode_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "test\\u", "file_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "psutil_", "._", "Process_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "give", "up", "\\u", "at_", "=_", "time_", "._", "time_", "(_", ")_", "+_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "file_", "in_", "p_", "._", "open", "\\u", "files_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "file_", "._", "path_", "==_", "os_", "._", "path_", "._", "abspath_", "(_", "TESTFN_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "time_", "._", "time_", "(_", ")_", ">_", "give", "up", "\\u", "at_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Run", "time", "Error_", "(_", "\"", "timeo", "ut", " ", "look", "ing", " ", "for", " ", "test", " ", "file", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "TESTFN_", ",_", "\"", "w", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "get", "\\u", "test\\u", "file_", "(_", ")_", "._", "mode_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "TESTFN_", ",_", "\"", "r", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "get", "\\u", "test\\u", "file_", "(_", ")_", "._", "mode_", ",_", "\"", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "TESTFN_", ",_", "\"", "a", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "get", "\\u", "test\\u", "file_", "(_", ")_", "._", "mode_", ",_", "\"", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "TESTFN_", ",_", "\"", "r", "+\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "get", "\\u", "test\\u", "file_", "(_", ")_", "._", "mode_", ",_", "\"", "r", "+\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "TESTFN_", ",_", "\"", "w", "+\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "get", "\\u", "test\\u", "file_", "(_", ")_", "._", "mode_", ",_", "\"", "r", "+\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "TESTFN_", ",_", "\"", "a", "+\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "get", "\\u", "test\\u", "file_", "(_", ")_", "._", "mode_", ",_", "\"", "a", "+\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "note", ":", " ", "\"", "x", "\"", " ", "bit", " ", "is", " ", "not", " ", "supported_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "safe", "\\u", "remove_", "(_", "TESTFN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "TESTFN_", ",_", "\"", "x", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "get", "\\u", "test\\u", "file_", "(_", ")_", "._", "mode_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "safe", "\\u", "remove_", "(_", "TESTFN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "TESTFN_", ",_", "\"", "x", "+\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "get", "\\u", "test\\u", "file_", "(_", ")_", "._", "mode_", ",_", "\"", "r", "+\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
openfoodfacts/OpenFoodFacts-APIRestPython/flask_rest_service/resources_products.py
[ { "content": "import json\nimport pymongo\nfrom flask import request, abort, json\nfrom flask.ext import restful\nfrom flask.ext.restful import reqparse\nfrom flask_rest_service import app, api, mongo\nfrom bson.objectid import ObjectId\nfrom bson.code import Code\n\n# ----- /products -----\n\n\n# ----- /products/stats/info-----\n\n\n# ----- /product/<product_id> -----\n\n\n# ----- /products/brands -----\n\n\n# ----- /products/categories -----\n\n\n# ----- /products/countries -----\n\n\n# ----- /products/additives -----\n\n\n# ----- /products/allergens -----\n\n\n\napi.add_resource(ProductsList, '/products')\napi.add_resource(ProductsStats, '/products/stats/info')\napi.add_resource(ProductId, '/product/<string:barcode>')\napi.add_resource(ProductsBrands, '/products/brands')\napi.add_resource(ProductsCategories, '/products/categories')\napi.add_resource(ProductsCountries, '/products/countries')\napi.add_resource(ProductsAdditives, '/products/additives')\napi.add_resource(ProductsAllergens, '/products/allergens')", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ProductsList(restful.Resource):\n\n # ----- GET Request -----", "metadata": "root.ProductsList", "header": "['module', '___EOS___']", "index": 10 }, { "content": " def get(self):\n # ----- Get limit # in the request, 50 by default -----\n limit = request.args.get('limit',default=50,type=int)\n # ----- Get skip # in the request, 0 by default -----\n skip = request.args.get('skip',default=0,type=int)\n # ----- Get count # in the request, 0 by default -----\n count = request.args.get('count',default=0, type=int)\n # ----- See if we want short response or not, 0 by default -----\n short = request.args.get('short',default=0, type=int)\n # ----- Query -----\n query = request.args.get('q')\n\n\n # ----- The regex param makes it search \"like\" things, the options one tells to be case insensitive\n data = dict((key, {'$regex' : request.args.get(key), '$options' : '-i'}) for key in request.args.keys())\n\n # ----- Delete custom parameters from the request, since they are not in MongoDB -----\n # ----- And add filters to custom parameters : -----\n if request.args.get('limit'):\n del data['limit']\n\n if request.args.get('skip'):\n del data['skip']\n\n if request.args.get('count'):\n del data['count']\n\n if request.args.get('short'):\n del data['short']\n\n if request.args.get('q'):\n del data['q']\n\n # ----- Filter data returned -----\n # ----- If we just want a short response -----\n # ----- Tell which fields we want -----\n fieldsNeeded = {'code':1, 'lang':1, 'product_name':1}\n if request.args.get('short') and short == 1:\n if request.args.get('count') and count == 1 and not request.args.get('q'):\n return mongo.db.products.find(data, fieldsNeeded).count()\n elif not request.args.get('count') and not request.args.get('q'):\n return mongo.db.products.find(data, fieldsNeeded).sort('created_t', pymongo.DESCENDING).skip(skip).limit(limit)\n elif request.args.get('count') and count == 1 and request.args.get('q'):\n return mongo.db.products.find({ \"$text\" : { \"$search\": query } }, fieldsNeeded).count()\n else:\n return mongo.db.products.find({ \"$text\" : { \"$search\": query } }, fieldsNeeded).sort('created_t', pymongo.DESCENDING).skip(skip).limit(limit)\n else:\n if request.args.get('count') and count == 1 and not request.args.get('q'):\n return mongo.db.products.find(data).count()\n elif not request.args.get('count') and not request.args.get('q'):\n return mongo.db.products.find(data).sort('created_t', pymongo.DESCENDING).skip(skip).limit(limit)\n elif request.args.get('count') and count == 1 and request.args.get('q'):\n return mongo.db.products.find({ \"$text\" : { \"$search\": query } }).count()\n else:\n return mongo.db.products.find({ \"$text\" : { \"$search\": query } }).sort('created_t', pymongo.DESCENDING).skip(skip).limit(limit)", "metadata": "root.ProductsList.get", "header": "['class', 'ProductsList', '(', 'restful', '.', 'Resource', ')', ':', '___NEWLINE___', '___NL___', '# ----- GET Request -----', '___NL___', '___EOS___']", "index": 13 }, { "content": "class ProductsStats(restful.Resource):\n\n # ----- GET Request -----", "metadata": "root.ProductsStats", "header": "['module', '___EOS___']", "index": 71 }, { "content": " def get(self):\n\n map = Code(\"function () {\"\n \" var date = new Date(this.created_t*1000);\"\n \" var parsedDateMonth = date.getMonth();\"\n \" var parsedDateYear = date.getFullYear();\"\n \" var saltLevelsValue = null;\"\n \" var fatLevelsValue = null;\"\n \" var saturatedfatLevelsValue = null;\"\n \" var sugarsLevelsValue = null;\"\n \" if(!parsedDateYear || !parsedDateMonth) return;\"\n \" if(this.hasOwnProperty('nutrient_levels')) {\"\n \" saltLevelsValue = this.nutrient_levels.salt;\"\n \" fatLevelsValue = this.nutrient_levels.fat;\"\n \" saturatedfatLevelsValue = this['nutrient_levels']['saturated-fat'];\"\n \" sugarsLevelsValue = this.nutrient_levels.sugars;\"\n \" } else { saltLevelsValue = null; fatLevelsValue = null; saturatedfatLevelsValue = null, sugarsLevelsValue = null}\"\n \" emit({year : parsedDateYear, month : parsedDateMonth, saltlevels : saltLevelsValue, fatlevels : fatLevelsValue, saturatedfatlevels : saturatedfatLevelsValue, sugarslevels : sugarsLevelsValue}, {count:1});\"\n \"};\")\n\n reduce = Code(\"function (key, values) {\"\n \" var count = 0;\"\n \" var ret = {count : 0};\"\n \" for (index in values) {\"\n \" ret.count += values[index].count;\"\n \" }\"\n \" return ret;\" \n \" };\")\n\n listRes = []\n result = mongo.db.products.map_reduce(map, reduce, \"stats_products\")\n for doc in result.find():\n res = {}\n res['dateyear'] = doc['_id']['year']\n res['datemonth'] = doc['_id']['month']\n res['count'] = doc['value']['count']\n res['saltlevels'] = doc['_id']['saltlevels']\n res['saturatedfatlevels'] = doc['_id']['saturatedfatlevels']\n res['sugarslevels'] = doc['_id']['sugarslevels']\n res['fatlevels'] = doc['_id']['fatlevels']\n listRes.append(res)\n return listRes", "metadata": "root.ProductsStats.get", "header": "['class', 'ProductsStats', '(', 'restful', '.', 'Resource', ')', ':', '___NEWLINE___', '___NL___', '# ----- GET Request -----', '___NL___', '___EOS___']", "index": 74 }, { "content": "class ProductId(restful.Resource):\n\n # ----- GET Request -----", "metadata": "root.ProductId", "header": "['module', '___EOS___']", "index": 119 }, { "content": " def get(self, barcode):\n return mongo.db.products.find_one({\"code\":barcode})", "metadata": "root.ProductId.get", "header": "['class', 'ProductId', '(', 'restful', '.', 'Resource', ')', ':', '___NEWLINE___', '___NL___', '# ----- GET Request -----', '___NL___', '___EOS___']", "index": 122 }, { "content": "class ProductsBrands(restful.Resource):\n\n # ----- GET Request -----", "metadata": "root.ProductsBrands", "header": "['module', '___EOS___']", "index": 127 }, { "content": " def get(self):\n # ----- Get count # in the request, 0 by default -----\n count = request.args.get('count',default=0, type=int)\n query = request.args.get('query')\n\n if request.args.get('query'):\n map = Code(\"function () {\"\n \" if (!this.brands) return;\"\n \" emit(this.brands.trim(), 1);\"\n \"};\")\n\n reduce = Code(\"function (key, values) {\"\n \" var count = 0;\"\n \" for (index in values) {\"\n \" count += values[index];\"\n \" }\"\n \" return count;\" \n \" };\")\n\n result = mongo.db.products.map_reduce(map, reduce, \"brands_products\")\n\n res = []\n for doc in result.find({\"_id\": {'$regex' : query, '$options' : '-i'}}):\n res.append(doc['_id'])\n if request.args.get('count') and count == 1:\n return len(res)\n else:\n return res\n else:\n if request.args.get('count') and count == 1:\n return len(mongo.db.products.distinct('brands'))\n else:\n return mongo.db.products.distinct('brands')", "metadata": "root.ProductsBrands.get", "header": "['class', 'ProductsBrands', '(', 'restful', '.', 'Resource', ')', ':', '___NEWLINE___', '___NL___', '# ----- GET Request -----', '___NL___', '___EOS___']", "index": 130 }, { "content": "class ProductsCategories(restful.Resource):\n\n # ----- GET Request -----", "metadata": "root.ProductsCategories", "header": "['module', '___EOS___']", "index": 166 }, { "content": " def get(self):\n # ----- Get count # in the request, 0 by default -----\n count = request.args.get('count',default=0, type=int)\n query = request.args.get('query')\n\n if request.args.get('query'):\n map = Code(\"function () {\"\n \" if (!this.categories) return;\"\n \" emit(this.categories.trim(), 1);\"\n \"};\")\n\n reduce = Code(\"function (key, values) {\"\n \" var count = 0;\"\n \" for (index in values) {\"\n \" count += values[index];\"\n \" }\"\n \" return count;\" \n \" };\")\n\n result = mongo.db.products.map_reduce(map, reduce, \"categories_products\")\n\n res = []\n for doc in result.find({\"_id\": {'$regex' : query, '$options' : '-i'}}):\n res.append(doc['_id'])\n if request.args.get('count') and count == 1:\n return len(res)\n else:\n return res\n else:\n if request.args.get('count') and count == 1:\n return len(mongo.db.products.distinct('categories'))\n else:\n return mongo.db.products.distinct('categories')", "metadata": "root.ProductsCategories.get", "header": "['class', 'ProductsCategories', '(', 'restful', '.', 'Resource', ')', ':', '___NEWLINE___', '___NL___', '# ----- GET Request -----', '___NL___', '___EOS___']", "index": 169 }, { "content": "class ProductsCountries(restful.Resource):\n\n # ----- GET Request -----", "metadata": "root.ProductsCountries", "header": "['module', '___EOS___']", "index": 205 }, { "content": " def get(self):\n # ----- Get count # in the request, 0 by default -----\n count = request.args.get('count',default=0, type=int)\n query = request.args.get('query')\n\n if request.args.get('query'):\n map = Code(\"function () {\"\n \" if (!this.countries) return;\"\n \" emit(this.countries.trim(), 1);\"\n \"};\")\n\n reduce = Code(\"function (key, values) {\"\n \" var count = 0;\"\n \" for (index in values) {\"\n \" count += values[index];\"\n \" }\"\n \" return count;\" \n \" };\")\n\n result = mongo.db.products.map_reduce(map, reduce, \"countries_products\")\n\n res = []\n for doc in result.find({\"_id\": {'$regex' : query, '$options' : '-i'}}):\n res.append(doc['_id'])\n if request.args.get('count') and count == 1:\n return len(res)\n else:\n return res\n else:\n if request.args.get('count') and count == 1:\n return len(mongo.db.products.distinct('countries'))\n else:\n return mongo.db.products.distinct('countries')", "metadata": "root.ProductsCountries.get", "header": "['class', 'ProductsCountries', '(', 'restful', '.', 'Resource', ')', ':', '___NEWLINE___', '___NL___', '# ----- GET Request -----', '___NL___', '___EOS___']", "index": 208 }, { "content": "class ProductsAdditives(restful.Resource):\n\n # ----- GET Request -----", "metadata": "root.ProductsAdditives", "header": "['module', '___EOS___']", "index": 244 }, { "content": " def get(self):\n # ----- Get count # in the request, 0 by default -----\n count = request.args.get('count',default=0, type=int)\n query = request.args.get('query')\n\n if request.args.get('query'):\n map = Code(\"function () {\"\n \" if (!this.colours) return;\"\n \" this.additives_tags.forEach(function (c){\"\n \" emit(c.trim(), 1)\"\n \" });\"\n \"};\")\n\n reduce = Code(\"function (key, values) {\"\n \" var count = 0;\"\n \" for (index in values) {\"\n \" count += values[index];\"\n \" }\"\n \" return count;\" \n \" };\")\n\n result = mongo.db.products.map_reduce(map, reduce, \"additives_products\")\n\n res = []\n for doc in result.find({\"_id\": {'$regex' : query, '$options' : '-i'}}):\n res.append(doc['_id'])\n if request.args.get('count') and count == 1:\n return len(res)\n else:\n return res\n else:\n if request.args.get('count') and count == 1:\n return len(mongo.db.products.distinct('additives_tags'))\n else:\n return mongo.db.products.distinct('additives_tags')", "metadata": "root.ProductsAdditives.get", "header": "['class', 'ProductsAdditives', '(', 'restful', '.', 'Resource', ')', ':', '___NEWLINE___', '___NL___', '# ----- GET Request -----', '___NL___', '___EOS___']", "index": 247 }, { "content": "class ProductsAllergens(restful.Resource):\n\n # ----- GET Request -----", "metadata": "root.ProductsAllergens", "header": "['module', '___EOS___']", "index": 285 }, { "content": " def get(self):\n # ----- Get count # in the request, 0 by default -----\n count = request.args.get('count',default=0, type=int)\n query = request.args.get('query')\n\n if request.args.get('query'):\n map = Code(\"function () {\"\n \" if (!this.colours) return;\"\n \" this.allergens_tags.forEach(function (c){\"\n \" emit(c.trim(), 1)\"\n \" });\"\n \"};\")\n\n reduce = Code(\"function (key, values) {\"\n \" var count = 0;\"\n \" for (index in values) {\"\n \" count += values[index];\"\n \" }\"\n \" return count;\" \n \" };\")\n\n result = mongo.db.products.map_reduce(map, reduce, \"allergens_products\")\n\n res = []\n for doc in result.find({\"_id\": {'$regex' : query, '$options' : '-i'}}):\n res.append(doc['_id'])\n if request.args.get('count') and count == 1:\n return len(res)\n else:\n return res\n else:\n if request.args.get('count') and count == 1:\n return len(mongo.db.products.distinct('allergens_tags'))\n else:\n return mongo.db.products.distinct('allergens_tags')", "metadata": "root.ProductsAllergens.get", "header": "['class', 'ProductsAllergens', '(', 'restful', '.', 'Resource', ')', ':', '___NEWLINE___', '___NL___', '# ----- GET Request -----', '___NL___', '___EOS___']", "index": 288 } ]
[ { "span": "import json", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 11 }, { "span": "from flask import request, abort, json", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 38 }, { "span": "from flask.ext.restful import reqparse", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 38 }, { "span": "from flask_rest_service import app, api, mongo", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 46 }, { "span": "from bson.objectid import ObjectId", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 34 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pymongo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "import_", "request_", ",_", "abort_", ",_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "._", "ext_", "import_", "restful", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "._", "ext_", "._", "restful", "_", "import_", "reqp", "arse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fla", "sk", "\\u", "rest", "\\u", "service_", "import_", "app_", ",_", "api_", ",_", "mongo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bson_", "._", "objectid", "_", "import_", "Object", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bson_", "._", "code_", "import_", "Code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "/", "products", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "/", "products", "/", "stats", "/", "info", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "/", "product", "/", "<", "product", "\\u", "id", ">", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "/", "products", "/", "brand", "s", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "/", "products", "/", "categor", "ies", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "/", "products", "/", "countr", "ies", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "/", "products", "/", "additi", "ves", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "/", "products", "/", "alle", "rge", "ns", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "api_", "._", "add", "\\u", "resource_", "(_", "Product", "s", "List_", ",_", "'/", "products", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api_", "._", "add", "\\u", "resource_", "(_", "Product", "s", "Stats_", ",_", "'/", "products", "/", "stats", "/", "info", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api_", "._", "add", "\\u", "resource_", "(_", "Product", "Id_", ",_", "'/", "product", "/", "<", "string", ":", "barcode", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api_", "._", "add", "\\u", "resource_", "(_", "Product", "s", "Brand", "s_", ",_", "'/", "products", "/", "brand", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api_", "._", "add", "\\u", "resource_", "(_", "Product", "s", "Categories_", ",_", "'/", "products", "/", "categor", "ies", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api_", "._", "add", "\\u", "resource_", "(_", "Product", "s", "Count", "ries_", ",_", "'/", "products", "/", "countr", "ies", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api_", "._", "add", "\\u", "resource_", "(_", "Product", "s", "Add", "iti", "ves_", ",_", "'/", "products", "/", "additi", "ves", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api_", "._", "add", "\\u", "resource_", "(_", "Product", "s", "Alle", "rge", "ns_", ",_", "'/", "products", "/", "alle", "rge", "ns", "'_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Product", "s", "List_", "(_", "restful", "_", "._", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "GET", " ", "Request", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Product", "s", "List_", "(_", "restful", "_", "._", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "GET", " ", "Request", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "-----", " ", "Get", " ", "limit", " ", "#", " ", "in", " ", "the", " ", "request", ",", " ", "50", " ", "by", " ", "default", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "limit_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "limit", "'_", ",_", "default_", "=_", "50_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "-----", " ", "Get", " ", "skip", " ", "#", " ", "in", " ", "the", " ", "request", ",", " ", "0", " ", "by", " ", "default", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "skip_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "skip", "'_", ",_", "default_", "=_", "0_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "-----", " ", "Get", " ", "count", " ", "#", " ", "in", " ", "the", " ", "request", ",", " ", "0", " ", "by", " ", "default", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "count_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "count", "'_", ",_", "default_", "=_", "0_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "-----", " ", "See", " ", "if", " ", "we", " ", "want", " ", "short", " ", "response", " ", "or", " ", "not", ",", " ", "0", " ", "by", " ", "default", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "short_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "short", "'_", ",_", "default_", "=_", "0_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "-----", " ", "Query", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "query_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "q", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "The", " ", "regex", " ", "param", " ", "make", "s", " ", "it", " ", "search", " ", "\"", "like", "\"", " ", "thing", "s", ",", " ", "the", " ", "options", " ", "one", " ", "tell", "s", " ", "to", " ", "be", " ", "case", " ", "inse", "nsitive", "_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "dict_", "(_", "(_", "key_", ",_", "{_", "'$", "regex", "'_", ":_", "request_", "._", "args_", "._", "get_", "(_", "key_", ")_", ",_", "'$", "options", "'_", ":_", "'-", "i", "'_", "}_", ")_", "for_", "key_", "in_", "request_", "._", "args_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "Delete", " ", "custom", " ", "parameter", "s", " ", "from", " ", "the", " ", "request", ",", " ", "sinc", "e", " ", "the", "y", " ", "are", " ", "not", " ", "in", " ", "Mon", "go", "DB", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "And", " ", "add", " ", "filter", "s", " ", "to", " ", "custom", " ", "parameter", "s", " ", ":", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "args_", "._", "get_", "(_", "'", "limit", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "data_", "[_", "'", "limit", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "args_", "._", "get_", "(_", "'", "skip", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "data_", "[_", "'", "skip", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "args_", "._", "get_", "(_", "'", "count", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "data_", "[_", "'", "count", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "args_", "._", "get_", "(_", "'", "short", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "data_", "[_", "'", "short", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "args_", "._", "get_", "(_", "'", "q", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "data_", "[_", "'", "q", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "Filter", " ", "data", " ", "return", "ed", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "If", " ", "we", " ", "just", " ", "want", " ", "a", " ", "short", " ", "response", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "Tell", " ", "whi", "ch", " ", "fields", " ", "we", " ", "want", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fields", "Needed", "_", "=_", "{_", "'", "code", "'_", ":_", "1_", ",_", "'", "lang", "'_", ":_", "1_", ",_", "'", "product", "\\u", "name", "'_", ":_", "1_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "args_", "._", "get_", "(_", "'", "short", "'_", ")_", "and_", "short_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "args_", "._", "get_", "(_", "'", "count", "'_", ")_", "and_", "count_", "==_", "1_", "and_", "not_", "request_", "._", "args_", "._", "get_", "(_", "'", "q", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mongo_", "._", "db_", "._", "products_", "._", "find_", "(_", "data_", ",_", "fields", "Needed", "_", ")_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "request_", "._", "args_", "._", "get_", "(_", "'", "count", "'_", ")_", "and_", "not_", "request_", "._", "args_", "._", "get_", "(_", "'", "q", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mongo_", "._", "db_", "._", "products_", "._", "find_", "(_", "data_", ",_", "fields", "Needed", "_", ")_", "._", "sort_", "(_", "'", "created", "\\u", "t", "'_", ",_", "pymongo_", "._", "DESC", "ENDING_", ")_", "._", "skip_", "(_", "skip_", ")_", "._", "limit_", "(_", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "request_", "._", "args_", "._", "get_", "(_", "'", "count", "'_", ")_", "and_", "count_", "==_", "1_", "and_", "request_", "._", "args_", "._", "get_", "(_", "'", "q", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mongo_", "._", "db_", "._", "products_", "._", "find_", "(_", "{_", "\"$", "text", "\"_", ":_", "{_", "\"$", "search", "\"_", ":_", "query_", "}_", "}_", ",_", "fields", "Needed", "_", ")_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mongo_", "._", "db_", "._", "products_", "._", "find_", "(_", "{_", "\"$", "text", "\"_", ":_", "{_", "\"$", "search", "\"_", ":_", "query_", "}_", "}_", ",_", "fields", "Needed", "_", ")_", "._", "sort_", "(_", "'", "created", "\\u", "t", "'_", ",_", "pymongo_", "._", "DESC", "ENDING_", ")_", "._", "skip_", "(_", "skip_", ")_", "._", "limit_", "(_", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "args_", "._", "get_", "(_", "'", "count", "'_", ")_", "and_", "count_", "==_", "1_", "and_", "not_", "request_", "._", "args_", "._", "get_", "(_", "'", "q", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mongo_", "._", "db_", "._", "products_", "._", "find_", "(_", "data_", ")_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "request_", "._", "args_", "._", "get_", "(_", "'", "count", "'_", ")_", "and_", "not_", "request_", "._", "args_", "._", "get_", "(_", "'", "q", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mongo_", "._", "db_", "._", "products_", "._", "find_", "(_", "data_", ")_", "._", "sort_", "(_", "'", "created", "\\u", "t", "'_", ",_", "pymongo_", "._", "DESC", "ENDING_", ")_", "._", "skip_", "(_", "skip_", ")_", "._", "limit_", "(_", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "request_", "._", "args_", "._", "get_", "(_", "'", "count", "'_", ")_", "and_", "count_", "==_", "1_", "and_", "request_", "._", "args_", "._", "get_", "(_", "'", "q", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mongo_", "._", "db_", "._", "products_", "._", "find_", "(_", "{_", "\"$", "text", "\"_", ":_", "{_", "\"$", "search", "\"_", ":_", "query_", "}_", "}_", ")_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mongo_", "._", "db_", "._", "products_", "._", "find_", "(_", "{_", "\"$", "text", "\"_", ":_", "{_", "\"$", "search", "\"_", ":_", "query_", "}_", "}_", ")_", "._", "sort_", "(_", "'", "created", "\\u", "t", "'_", ",_", "pymongo_", "._", "DESC", "ENDING_", ")_", "._", "skip_", "(_", "skip_", ")_", "._", "limit_", "(_", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Product", "s", "Stats_", "(_", "restful", "_", "._", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "GET", " ", "Request", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Product", "s", "Stats_", "(_", "restful", "_", "._", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "GET", " ", "Request", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "map_", "=_", "Code_", "(_", "\"", "function", " ", "()", " ", "{\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "var", " ", "date", " ", "=", " ", "new", " ", "Date", "(", "this", ".", "created", "\\u", "t", "*", "1000", ");\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "var", " ", "parsed", "Date", "Mont", "h", " ", "=", " ", "date", ".", "get", "Mont", "h", "();", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "var", " ", "parsed", "Date", "Year", " ", "=", " ", "date", ".", "get", "Full", "Year", "();", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "var", " ", "salt", "Levels", "Value", " ", "=", " ", "null", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "var", " ", "fat", "Levels", "Value", " ", "=", " ", "null", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "var", " ", "satur", "ated", "fat", "Levels", "Value", " ", "=", " ", "null", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "var", " ", "sugar", "s", "Levels", "Value", " ", "=", " ", "null", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "if", "(!", "parsed", "Date", "Year", " ", "||", " ", "!", "parsed", "Date", "Mont", "h", ")", " ", "return", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "if", "(", "this", ".", "has", "Own", "Proper", "ty", "('", "nutri", "ent", "\\u", "level", "s", "'))", " ", "{\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "salt", "Levels", "Value", " ", "=", " ", "this", ".", "nutri", "ent", "\\u", "level", "s", ".", "salt", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "fat", "Levels", "Value", " ", "=", " ", "this", ".", "nutri", "ent", "\\u", "level", "s", ".", "fat", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "satur", "ated", "fat", "Levels", "Value", " ", "=", " ", "this", "['", "nutri", "ent", "\\u", "level", "s", "']", "['", "satur", "ated", "-", "fat", "']", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "sugar", "s", "Levels", "Value", " ", "=", " ", "this", ".", "nutri", "ent", "\\u", "level", "s", ".", "sugar", "s", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "}", " ", "else", " ", "{", " ", "salt", "Levels", "Value", " ", "=", " ", "null", ";", " ", "fat", "Levels", "Value", " ", "=", " ", "null", ";", " ", "satur", "ated", "fat", "Levels", "Value", " ", "=", " ", "null", ",", " ", "sugar", "s", "Levels", "Value", " ", "=", " ", "null", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "emit", "({", "year", " ", ":", " ", "parsed", "Date", "Year", ",", " ", "month", " ", ":", " ", "parsed", "Date", "Mont", "h", ",", " ", "salt", "level", "s", " ", ":", " ", "salt", "Levels", "Value", ",", " ", "fat", "level", "s", " ", ":", " ", "fat", "Levels", "Value", ",", " ", "satur", "ated", "fat", "level", "s", " ", ":", " ", "satur", "ated", "fat", "Levels", "Value", ",", " ", "sugar", "sle", "vels", " ", ":", " ", "sugar", "s", "Levels", "Value", "},", " ", "{", "count", ":", "1", "})", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"}", ";\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reduce_", "=_", "Code_", "(_", "\"", "function", " ", "(", "key", ",", " ", "values", ")", " ", "{\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "var", " ", "count", " ", "=", " ", "0", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "var", " ", "ret", " ", "=", " ", "{", "count", " ", ":", " ", "0", "};", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "for", " ", "(", "index", " ", "in", " ", "values", ")", " ", "{\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "ret", ".", "count", " ", "+=", " ", "values", "[", "index", "].", "count", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "return", " ", "ret", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "};", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "list", "Res_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "mongo_", "._", "db_", "._", "products_", "._", "map", "\\u", "reduce_", "(_", "map_", ",_", "reduce_", ",_", "\"", "stats", "\\u", "products", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "doc_", "in_", "result_", "._", "find_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "[_", "'", "date", "year", "'_", "]_", "=_", "doc_", "[_", "'\\u", "id", "'_", "]_", "[_", "'", "year", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "[_", "'", "date", "month", "'_", "]_", "=_", "doc_", "[_", "'\\u", "id", "'_", "]_", "[_", "'", "month", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "[_", "'", "count", "'_", "]_", "=_", "doc_", "[_", "'", "value", "'_", "]_", "[_", "'", "count", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "[_", "'", "salt", "level", "s", "'_", "]_", "=_", "doc_", "[_", "'\\u", "id", "'_", "]_", "[_", "'", "salt", "level", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "[_", "'", "satur", "ated", "fat", "level", "s", "'_", "]_", "=_", "doc_", "[_", "'\\u", "id", "'_", "]_", "[_", "'", "satur", "ated", "fat", "level", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "[_", "'", "sugar", "sle", "vels", "'_", "]_", "=_", "doc_", "[_", "'\\u", "id", "'_", "]_", "[_", "'", "sugar", "sle", "vels", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "[_", "'", "fat", "level", "s", "'_", "]_", "=_", "doc_", "[_", "'\\u", "id", "'_", "]_", "[_", "'", "fat", "level", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "Res_", "._", "append_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "list", "Res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Product", "Id_", "(_", "restful", "_", "._", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "GET", " ", "Request", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Product", "Id_", "(_", "restful", "_", "._", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "GET", " ", "Request", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ",_", "barcode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mongo_", "._", "db_", "._", "products_", "._", "find", "\\u", "one_", "(_", "{_", "\"", "code", "\"_", ":_", "barcode_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Product", "s", "Brand", "s_", "(_", "restful", "_", "._", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "GET", " ", "Request", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Product", "s", "Brand", "s_", "(_", "restful", "_", "._", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "GET", " ", "Request", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "-----", " ", "Get", " ", "count", " ", "#", " ", "in", " ", "the", " ", "request", ",", " ", "0", " ", "by", " ", "default", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "count_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "count", "'_", ",_", "default_", "=_", "0_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "query", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "args_", "._", "get_", "(_", "'", "query", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "map_", "=_", "Code_", "(_", "\"", "function", " ", "()", " ", "{\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "if", " ", "(!", "this", ".", "brand", "s", ")", " ", "return", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "emit", "(", "this", ".", "brand", "s", ".", "trim", "()", ",", " ", "1", ");\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"}", ";\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reduce_", "=_", "Code_", "(_", "\"", "function", " ", "(", "key", ",", " ", "values", ")", " ", "{\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "var", " ", "count", " ", "=", " ", "0", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "for", " ", "(", "index", " ", "in", " ", "values", ")", " ", "{\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "count", " ", "+=", " ", "values", "[", "index", "];", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "return", " ", "count", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "};", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "mongo_", "._", "db_", "._", "products_", "._", "map", "\\u", "reduce_", "(_", "map_", ",_", "reduce_", ",_", "\"", "brand", "s", "\\u", "products", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "doc_", "in_", "result_", "._", "find_", "(_", "{_", "\"\\u", "id", "\"_", ":_", "{_", "'$", "regex", "'_", ":_", "query_", ",_", "'$", "options", "'_", ":_", "'-", "i", "'_", "}_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "._", "append_", "(_", "doc_", "[_", "'\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "args_", "._", "get_", "(_", "'", "count", "'_", ")_", "and_", "count_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "args_", "._", "get_", "(_", "'", "count", "'_", ")_", "and_", "count_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "mongo_", "._", "db_", "._", "products_", "._", "distinct_", "(_", "'", "brand", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mongo_", "._", "db_", "._", "products_", "._", "distinct_", "(_", "'", "brand", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Product", "s", "Categories_", "(_", "restful", "_", "._", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "GET", " ", "Request", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Product", "s", "Categories_", "(_", "restful", "_", "._", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "GET", " ", "Request", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "-----", " ", "Get", " ", "count", " ", "#", " ", "in", " ", "the", " ", "request", ",", " ", "0", " ", "by", " ", "default", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "count_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "count", "'_", ",_", "default_", "=_", "0_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "query", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "args_", "._", "get_", "(_", "'", "query", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "map_", "=_", "Code_", "(_", "\"", "function", " ", "()", " ", "{\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "if", " ", "(!", "this", ".", "categor", "ies", ")", " ", "return", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "emit", "(", "this", ".", "categor", "ies", ".", "trim", "()", ",", " ", "1", ");\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"}", ";\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reduce_", "=_", "Code_", "(_", "\"", "function", " ", "(", "key", ",", " ", "values", ")", " ", "{\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "var", " ", "count", " ", "=", " ", "0", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "for", " ", "(", "index", " ", "in", " ", "values", ")", " ", "{\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "count", " ", "+=", " ", "values", "[", "index", "];", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "return", " ", "count", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "};", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "mongo_", "._", "db_", "._", "products_", "._", "map", "\\u", "reduce_", "(_", "map_", ",_", "reduce_", ",_", "\"", "categor", "ies", "\\u", "products", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "doc_", "in_", "result_", "._", "find_", "(_", "{_", "\"\\u", "id", "\"_", ":_", "{_", "'$", "regex", "'_", ":_", "query_", ",_", "'$", "options", "'_", ":_", "'-", "i", "'_", "}_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "._", "append_", "(_", "doc_", "[_", "'\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "args_", "._", "get_", "(_", "'", "count", "'_", ")_", "and_", "count_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "args_", "._", "get_", "(_", "'", "count", "'_", ")_", "and_", "count_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "mongo_", "._", "db_", "._", "products_", "._", "distinct_", "(_", "'", "categor", "ies", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mongo_", "._", "db_", "._", "products_", "._", "distinct_", "(_", "'", "categor", "ies", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Product", "s", "Count", "ries_", "(_", "restful", "_", "._", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "GET", " ", "Request", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Product", "s", "Count", "ries_", "(_", "restful", "_", "._", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "GET", " ", "Request", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "-----", " ", "Get", " ", "count", " ", "#", " ", "in", " ", "the", " ", "request", ",", " ", "0", " ", "by", " ", "default", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "count_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "count", "'_", ",_", "default_", "=_", "0_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "query", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "args_", "._", "get_", "(_", "'", "query", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "map_", "=_", "Code_", "(_", "\"", "function", " ", "()", " ", "{\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "if", " ", "(!", "this", ".", "countr", "ies", ")", " ", "return", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "emit", "(", "this", ".", "countr", "ies", ".", "trim", "()", ",", " ", "1", ");\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"}", ";\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reduce_", "=_", "Code_", "(_", "\"", "function", " ", "(", "key", ",", " ", "values", ")", " ", "{\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "var", " ", "count", " ", "=", " ", "0", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "for", " ", "(", "index", " ", "in", " ", "values", ")", " ", "{\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "count", " ", "+=", " ", "values", "[", "index", "];", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "return", " ", "count", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "};", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "mongo_", "._", "db_", "._", "products_", "._", "map", "\\u", "reduce_", "(_", "map_", ",_", "reduce_", ",_", "\"", "countr", "ies", "\\u", "products", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "doc_", "in_", "result_", "._", "find_", "(_", "{_", "\"\\u", "id", "\"_", ":_", "{_", "'$", "regex", "'_", ":_", "query_", ",_", "'$", "options", "'_", ":_", "'-", "i", "'_", "}_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "._", "append_", "(_", "doc_", "[_", "'\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "args_", "._", "get_", "(_", "'", "count", "'_", ")_", "and_", "count_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "args_", "._", "get_", "(_", "'", "count", "'_", ")_", "and_", "count_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "mongo_", "._", "db_", "._", "products_", "._", "distinct_", "(_", "'", "countr", "ies", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mongo_", "._", "db_", "._", "products_", "._", "distinct_", "(_", "'", "countr", "ies", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Product", "s", "Add", "iti", "ves_", "(_", "restful", "_", "._", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "GET", " ", "Request", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Product", "s", "Add", "iti", "ves_", "(_", "restful", "_", "._", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "GET", " ", "Request", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "-----", " ", "Get", " ", "count", " ", "#", " ", "in", " ", "the", " ", "request", ",", " ", "0", " ", "by", " ", "default", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "count_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "count", "'_", ",_", "default_", "=_", "0_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "query", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "args_", "._", "get_", "(_", "'", "query", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "map_", "=_", "Code_", "(_", "\"", "function", " ", "()", " ", "{\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "if", " ", "(!", "this", ".", "colour", "s", ")", " ", "return", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "this", ".", "additi", "ves", "\\u", "tags", ".", "for", "Ea", "ch", "(", "function", " ", "(", "c", "){", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "emit", "(", "c", ".", "trim", "()", ",", " ", "1", ")\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "})", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"}", ";\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reduce_", "=_", "Code_", "(_", "\"", "function", " ", "(", "key", ",", " ", "values", ")", " ", "{\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "var", " ", "count", " ", "=", " ", "0", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "for", " ", "(", "index", " ", "in", " ", "values", ")", " ", "{\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "count", " ", "+=", " ", "values", "[", "index", "];", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "return", " ", "count", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "};", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "mongo_", "._", "db_", "._", "products_", "._", "map", "\\u", "reduce_", "(_", "map_", ",_", "reduce_", ",_", "\"", "additi", "ves", "\\u", "products", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "doc_", "in_", "result_", "._", "find_", "(_", "{_", "\"\\u", "id", "\"_", ":_", "{_", "'$", "regex", "'_", ":_", "query_", ",_", "'$", "options", "'_", ":_", "'-", "i", "'_", "}_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "._", "append_", "(_", "doc_", "[_", "'\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "args_", "._", "get_", "(_", "'", "count", "'_", ")_", "and_", "count_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "args_", "._", "get_", "(_", "'", "count", "'_", ")_", "and_", "count_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "mongo_", "._", "db_", "._", "products_", "._", "distinct_", "(_", "'", "additi", "ves", "\\u", "tags", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mongo_", "._", "db_", "._", "products_", "._", "distinct_", "(_", "'", "additi", "ves", "\\u", "tags", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Product", "s", "Alle", "rge", "ns_", "(_", "restful", "_", "._", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "GET", " ", "Request", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Product", "s", "Alle", "rge", "ns_", "(_", "restful", "_", "._", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "GET", " ", "Request", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "-----", " ", "Get", " ", "count", " ", "#", " ", "in", " ", "the", " ", "request", ",", " ", "0", " ", "by", " ", "default", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "count_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "count", "'_", ",_", "default_", "=_", "0_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "query", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "args_", "._", "get_", "(_", "'", "query", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "map_", "=_", "Code_", "(_", "\"", "function", " ", "()", " ", "{\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "if", " ", "(!", "this", ".", "colour", "s", ")", " ", "return", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "this", ".", "alle", "rge", "ns", "\\u", "tags", ".", "for", "Ea", "ch", "(", "function", " ", "(", "c", "){", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "emit", "(", "c", ".", "trim", "()", ",", " ", "1", ")\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "})", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"}", ";\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reduce_", "=_", "Code_", "(_", "\"", "function", " ", "(", "key", ",", " ", "values", ")", " ", "{\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "var", " ", "count", " ", "=", " ", "0", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "for", " ", "(", "index", " ", "in", " ", "values", ")", " ", "{\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "count", " ", "+=", " ", "values", "[", "index", "];", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "return", " ", "count", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "};", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "mongo_", "._", "db_", "._", "products_", "._", "map", "\\u", "reduce_", "(_", "map_", ",_", "reduce_", ",_", "\"", "alle", "rge", "ns", "\\u", "products", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "doc_", "in_", "result_", "._", "find_", "(_", "{_", "\"\\u", "id", "\"_", ":_", "{_", "'$", "regex", "'_", ":_", "query_", ",_", "'$", "options", "'_", ":_", "'-", "i", "'_", "}_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "._", "append_", "(_", "doc_", "[_", "'\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "args_", "._", "get_", "(_", "'", "count", "'_", ")_", "and_", "count_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "args_", "._", "get_", "(_", "'", "count", "'_", ")_", "and_", "count_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "mongo_", "._", "db_", "._", "products_", "._", "distinct_", "(_", "'", "alle", "rge", "ns", "\\u", "tags", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mongo_", "._", "db_", "._", "products_", "._", "distinct_", "(_", "'", "alle", "rge", "ns", "\\u", "tags", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
GeoscienceAustralia/agdc/deprecated/integrity_checker.py
[ { "content": "#!/usr/bin/env python\n\n#===============================================================================\n# Copyright (c) 2014 Geoscience Australia\n# All rights reserved.\n# \n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are met:\n# * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n# * Redistributions in binary form must reproduce the above copyright\n# notice, this list of conditions and the following disclaimer in the\n# documentation and/or other materials provided with the distribution.\n# * Neither Geoscience Australia nor the names of its contributors may be\n# used to endorse or promote products derived from this software\n# without specific prior written permission.\n# \n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY\n# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n#===============================================================================\n\n'''\nScript to check whether tile files are valid GDAL datasets\n\nCreated on 07/03/2013\n\n@author: u76345\n'''\nimport os\nimport logging\nfrom osgeo import gdal\nfrom EOtools.utils import log_multiline\nfrom EOtools.execute import execute\nimport sys\nfrom time import sleep\nfrom agdc import DataCube\n\n# Set top level standard output \nconsole_handler = logging.StreamHandler(sys.stdout)\nconsole_handler.setLevel(logging.INFO)\nconsole_formatter = logging.Formatter('%(message)s')\nconsole_handler.setFormatter(console_formatter)\n\nlogger = logging.getLogger(__name__)\nif not logger.level:\n logger.setLevel(logging.DEBUG) # Default logging level for all modules\n logger.addHandler(console_handler)\n \n\n\nif __name__ == '__main__':\n integrity_checker = IntegrityChecker()\n \n if integrity_checker.debug:\n console_handler.setLevel(logging.DEBUG)\n \n integrity_checker.check_files(level_name_tuple=('NBAR',))\n \n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class IntegrityChecker(DataCube):\n '''\n classdocs\n '''\n\n", "metadata": "root.IntegrityChecker", "header": "['module', '___EOS___']", "index": 56 }, { "content": " def check_files(self, path_prefix=None, level_name_tuple=None, tile_type_id=1):\n '''\n Function to iterate through all tile records and return a list of invalid paths\n '''\n query_cursor = self.db_connection.cursor()\n check_cursor = self.db_connection.cursor()\n update_cursor = self.db_connection.cursor()\n \n query_sql = \"\"\"-- Retrieve all tile details for specified tile range\nselect\n tile_id,\n tile_pathname\nfrom tile\n\"\"\"\n\n if level_name_tuple:\n query_sql += \"\"\" inner join dataset using(dataset_id)\n inner join acquisition using(acquisition_id)\n inner join processing_level using(level_id)\n\"\"\"\n\n query_sql += \"\"\"where tile_type_id = %(tile_type_id)s\n and tile_class_id = 1 -- Non-empty tile\n and tile_status is null -- Not checked yet \n\"\"\"\n \n if level_name_tuple:\n query_sql += \"\"\" and level_name in %(level_name_list)s\n\"\"\" \n\n if path_prefix:\n query_sql += \"\"\" and tile_pathname like %(path_prefix)s || '%%'\n\"\"\" \n\n query_sql += \"\"\"order by x_index, y_index, start_datetime\nlimit 1000 -- Keep the query small and refresh it frequently\n\"\"\" \n\n query_params = {'tile_type_id': tile_type_id,\n 'path_prefix': path_prefix,\n 'level_name_list': level_name_tuple\n }\n \n log_multiline(logger.debug, query_cursor.mogrify(query_sql, query_params), 'SQL', '\\t')\n \n while True:\n while not self.lock_object('integrity check query'):\n sleep(10)\n \n try:\n query_cursor.execute(query_sql, query_params)\n finally:\n self.unlock_object('integrity check query')\n \n if not query_cursor: # Nothing else to process\n break\n \n for record in query_cursor:\n tile_id = record[0]\n tile_pathname = record[1]\n \n check_sql=\"\"\"-- Check whether tile_status has already been assigned (quick)\nselect tile_id\nfrom tile\nwhere tile_id = %(tile_id)s\n and tile_type_id = %(tile_type_id)s\n and tile_class_id = 1 -- Non-empty tile\n and tile_status is null -- Not checked yet \n\"\"\"\n check_params = {'tile_id': tile_id,\n 'tile_type_id': tile_type_id\n }\n \n log_multiline(logger.debug, check_cursor.mogrify(check_sql, check_params), 'SQL', '\\t')\n check_cursor.execute(check_sql, check_params)\n \n if not check_cursor:\n continue # Already processed - skip it\n \n if self.lock_object(tile_pathname):\n tile_status = 0 # Assume OK\n try:\n if not os.path.exists(tile_pathname):\n tile_status = 1 # Doesn't exist\n else:\n dataset = gdal.Open(tile_pathname)\n if dataset:\n try:\n array = dataset.GetRasterBand(dataset.RasterCount).ReadAsArray()\n # Everything should be OK at this point\n except Exception, e:\n logger.debug('Tile read failed: ', e.message)\n tile_status = 3 # Can't read\n else:\n tile_status = 2 # Can't open\n \n logger.info('%s status = %d', tile_pathname, tile_status) \n \n update_sql = \"\"\"update tile \n set tile_status = %(tile_status)s \n where tile_id = %(tile_id)s\n \"\"\"\n update_params = {'tile_status': tile_status,\n 'tile_id': tile_id\n }\n log_multiline(logger.debug, update_cursor.mogrify(update_sql, update_params), 'SQL', '\\t')\n update_cursor.execute(update_sql, update_params)\n self.db_connection.commit()\n except Exception, e:\n logger.error(e.message)\n self.db_connection.rollback() \n finally:\n self.unlock_object(tile_pathname) ", "metadata": "root.IntegrityChecker.check_files", "header": "['class', 'IntegrityChecker', '(', 'DataCube', ')', ':', '___EOS___']", "index": 62 } ]
[ { "span": "from EOtools.execute import execute", "start_line": 40, "start_column": 0, "end_line": 40, "end_column": 35 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "==============", "==============", "==============", "==============", "==============", "=========", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", " ", "2014", " ", "Geos", "cienc", "e", " ", "Aust", "ral", "ia_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyright_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyright_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "Nei", "ther", " ", "Geos", "cienc", "e", " ", "Aust", "ral", "ia", " ", "nor", " ", "the", " ", "names", " ", "of", " ", "its", " ", "contributor", "s", " ", "may", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "used", " ", "to", " ", "endo", "rse", " ", "or", " ", "promote", " ", "products", " ", "derive", "d", " ", "from", " ", "this", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "with", "out", " ", "specific", " ", "prior", " ", "writt", "en", " ", "permissi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS", " ", "\"", "AS", " ", "IS", "\"", " ", "AND_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "THE", " ", "IMPL", "IED", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "ARE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ER", " ", "OR", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "==============", "==============", "==============", "==============", "==============", "=========", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "Script", " ", "to", " ", "check", " ", "whe", "ther", " ", "tile", " ", "files", " ", "are", " ", "valid", " ", "GDA", "L", " ", "dataset", "s", "\\", "10", ";", "\\", "10", ";", "Creat", "ed", " ", "on", " ", "0", "7", "/", "03", "/", "2013", "\\", "10", ";", "\\", "10", ";", "@", "author", ":", " ", "u", "763", "4", "5", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "osg", "eo_", "import_", "gdal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "EO", "tools_", "._", "utils_", "import_", "log", "\\u", "multiline", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "EO", "tools_", "._", "execute_", "import_", "execute_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "time_", "import_", "sleep_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ag", "dc_", "import_", "Data", "Cube_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "top", " ", "level", " ", "standard", " ", "output", " _", "\\u\\u\\uNL\\u\\u\\u_", "console", "\\u", "handler_", "=_", "logging_", "._", "Stream", "Handler_", "(_", "sys_", "._", "stdout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console", "\\u", "handler_", "._", "set", "Level_", "(_", "logging_", "._", "INFO_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console", "\\u", "formatter_", "=_", "logging_", "._", "Formatter_", "(_", "'%", "(", "message", ")", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console", "\\u", "handler_", "._", "set", "Formatter_", "(_", "console", "\\u", "formatter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "logger_", "._", "level_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "set", "Level_", "(_", "logging_", "._", "DEBUG_", ")_", "#", " ", "Default", " ", "logg", "ing", " ", "level", " ", "for", " ", "all", " ", "modules_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "add", "Handler_", "(_", "console", "\\u", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "integrity", "\\u", "checker_", "=_", "Int", "egr", "it", "y", "Checker_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "integrity", "\\u", "checker_", "._", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "console", "\\u", "handler_", "._", "set", "Level_", "(_", "logging_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "integrity", "\\u", "checker_", "._", "check", "\\u", "files_", "(_", "level", "\\u", "name", "\\u", "tuple_", "=_", "(_", "'", "NB", "AR", "'_", ",_", ")_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Int", "egr", "it", "y", "Checker_", "(_", "Data", "Cube_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "classd", "ocs", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Int", "egr", "it", "y", "Checker_", "(_", "Data", "Cube_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "check", "\\u", "files_", "(_", "self_", ",_", "path", "\\u", "prefix_", "=_", "None_", ",_", "level", "\\u", "name", "\\u", "tuple_", "=_", "None_", ",_", "tile", "\\u", "type", "\\u", "id_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Function", " ", "to", " ", "iterate", " ", "through", " ", "all", " ", "tile", " ", "record", "s", " ", "and", " ", "return", " ", "a", " ", "list", " ", "of", " ", "invalid", " ", "path", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query", "\\u", "cursor_", "=_", "self_", "._", "db", "\\u", "connection_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "\\u", "cursor_", "=_", "self_", "._", "db", "\\u", "connection_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "\\u", "cursor_", "=_", "self_", "._", "db", "\\u", "connection_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "query", "\\u", "sql_", "=_", "\"\"\"", "--", " ", "Retrieve", " ", "all", " ", "tile", " ", "deta", "il", "s", " ", "for", " ", "specified", " ", "tile", " ", "range", "\\", "10", ";", "select", "\\", "10", ";", " ", " ", "tile", "\\u", "id", ",", "\\", "10", ";", " ", " ", "tile", "\\u", "path", "name", "\\", "10", ";", "from", " ", "tile", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "level", "\\u", "name", "\\u", "tuple_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query", "\\u", "sql_", "+=_", "\"\"\"", " ", " ", "inner", " ", "join", " ", "dataset", " ", "usi", "ng", "(", "dataset", "\\u", "id", ")", "\\", "10", ";", " ", " ", "inner", " ", "join", " ", "acquisition", " ", "usi", "ng", "(", "acquisition", "\\u", "id", ")", "\\", "10", ";", " ", " ", "inner", " ", "join", " ", "process", "ing", "\\u", "level", " ", "usi", "ng", "(", "level", "\\u", "id", ")", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "query", "\\u", "sql_", "+=_", "\"\"\"", "where", " ", "tile", "\\u", "type", "\\u", "id", " ", "=", " ", "%", "(", "tile", "\\u", "type", "\\u", "id", ")", "s", "\\", "10", ";", " ", " ", "and", " ", "tile", "\\u", "class", "\\u", "id", " ", "=", " ", "1", " ", "--", " ", "Non", "-", "empty", " ", "tile", "\\", "10", ";", " ", " ", "and", " ", "tile", "\\u", "status", " ", "is", " ", "null", " ", "--", " ", "Not", " ", "checke", "d", " ", "ye", "t", " ", " ", " ", " ", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "level", "\\u", "name", "\\u", "tuple_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query", "\\u", "sql_", "+=_", "\"\"\"", " ", " ", "and", " ", "level", "\\u", "name", " ", "in", " ", "%", "(", "level", "\\u", "name", "\\u", "list", ")", "s", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "path", "\\u", "prefix_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query", "\\u", "sql_", "+=_", "\"\"\"", " ", " ", "and", " ", "tile", "\\u", "path", "name", " ", "like", " ", "%", "(", "path", "\\u", "prefix", ")", "s", " ", "||", " ", "'%%", "'", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "query", "\\u", "sql_", "+=_", "\"\"\"", "order", " ", "by", " ", "x", "\\u", "index", ",", " ", "y", "\\u", "index", ",", " ", "start", "\\u", "datetime", "\\", "10", ";", "limit", " ", "1000", " ", "--", " ", "Keep", " ", "the", " ", "query", " ", "small", " ", "and", " ", "refre", "sh", " ", "it", " ", "frequent", "ly", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "query", "\\u", "params_", "=_", "{_", "'", "tile", "\\u", "type", "\\u", "id", "'_", ":_", "tile", "\\u", "type", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "\\u", "prefix", "'_", ":_", "path", "\\u", "prefix_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "level", "\\u", "name", "\\u", "list", "'_", ":_", "level", "\\u", "name", "\\u", "tuple_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "multiline", "_", "(_", "logger_", "._", "debug_", ",_", "query", "\\u", "cursor_", "._", "mog", "rif", "y_", "(_", "query", "\\u", "sql_", ",_", "query", "\\u", "params_", ")_", ",_", "'", "SQL", "'_", ",_", "'\\\\", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "not_", "self_", "._", "lock", "\\u", "object_", "(_", "'", "integrity", " ", "check", " ", "query", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sleep_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query", "\\u", "cursor_", "._", "execute_", "(_", "query", "\\u", "sql_", ",_", "query", "\\u", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "unlock", "\\u", "object_", "(_", "'", "integrity", " ", "check", " ", "query", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "query", "\\u", "cursor_", ":_", "#", " ", "Not", "hing", " ", "else", " ", "to", " ", "process_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "record_", "in_", "query", "\\u", "cursor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tile", "\\u", "id_", "=_", "record_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tile", "\\u", "pathname_", "=_", "record_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "check", "\\u", "sql_", "=_", "\"\"\"", "--", " ", "Check", " ", "whe", "ther", " ", "tile", "\\u", "status", " ", "has", " ", "alr", "ead", "y", " ", "bee", "n", " ", "assign", "ed", " ", "(", "quick", ")", "\\", "10", ";", "select", " ", "tile", "\\u", "id", "\\", "10", ";", "from", " ", "tile", "\\", "10", ";", "where", " ", "tile", "\\u", "id", " ", "=", " ", "%", "(", "tile", "\\u", "id", ")", "s", "\\", "10", ";", " ", " ", "and", " ", "tile", "\\u", "type", "\\u", "id", " ", "=", " ", "%", "(", "tile", "\\u", "type", "\\u", "id", ")", "s", "\\", "10", ";", " ", " ", "and", " ", "tile", "\\u", "class", "\\u", "id", " ", "=", " ", "1", " ", "--", " ", "Non", "-", "empty", " ", "tile", "\\", "10", ";", " ", " ", "and", " ", "tile", "\\u", "status", " ", "is", " ", "null", " ", "--", " ", "Not", " ", "checke", "d", " ", "ye", "t", " ", " ", " ", " ", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "\\u", "params_", "=_", "{_", "'", "tile", "\\u", "id", "'_", ":_", "tile", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tile", "\\u", "type", "\\u", "id", "'_", ":_", "tile", "\\u", "type", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "multiline", "_", "(_", "logger_", "._", "debug_", ",_", "check", "\\u", "cursor_", "._", "mog", "rif", "y_", "(_", "check", "\\u", "sql_", ",_", "check", "\\u", "params_", ")_", ",_", "'", "SQL", "'_", ",_", "'\\\\", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "\\u", "cursor_", "._", "execute_", "(_", "check", "\\u", "sql_", ",_", "check", "\\u", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "check", "\\u", "cursor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "#", " ", "Al", "read", "y", " ", "process", "ed", " ", "-", " ", "skip", " ", "it_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "lock", "\\u", "object_", "(_", "tile", "\\u", "pathname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tile", "\\u", "status_", "=_", "0_", "#", " ", "Assume", " ", "OK_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "tile", "\\u", "pathname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "tile", "\\u", "status_", "=_", "1_", "#", " ", "Do", "esn", "'", "t", " ", "exist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "dataset_", "=_", "gdal_", "._", "Open_", "(_", "tile", "\\u", "pathname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dataset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "array_", "=_", "dataset_", "._", "Get", "Ras", "ter", "Band_", "(_", "dataset_", "._", "Ras", "ter", "Count_", ")_", "._", "Read", "As", "Array_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Every", "thing", " ", "shou", "ld", " ", "be", " ", "OK", " ", "at", " ", "this", " ", "point_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "logger_", "._", "debug_", "(_", "'", "Til", "e", " ", "read", " ", "fail", "ed", ":", " ", "'_", ",_", "e_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tile", "\\u", "status_", "=_", "3_", "#", " ", "Can", "'", "t", " ", "read_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "tile", "\\u", "status_", "=_", "2_", "#", " ", "Can", "'", "t", " ", "open_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "info_", "(_", "'%", "s", " ", "status", " ", "=", " ", "%", "d", "'_", ",_", "tile", "\\u", "pathname_", ",_", "tile", "\\u", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "\\u", "sql_", "=_", "\"\"\"", "update", " ", "tile", " ", "\\", "10", ";", " ", " ", " ", " ", "set", " ", "tile", "\\u", "status", " ", "=", " ", "%", "(", "tile", "\\u", "status", ")", "s", " ", " ", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "where", " ", "tile", "\\u", "id", " ", "=", " ", "%", "(", "tile", "\\u", "id", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "\\u", "params_", "=_", "{_", "'", "tile", "\\u", "status", "'_", ":_", "tile", "\\u", "status_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tile", "\\u", "id", "'_", ":_", "tile", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "multiline", "_", "(_", "logger_", "._", "debug_", ",_", "update", "\\u", "cursor_", "._", "mog", "rif", "y_", "(_", "update", "\\u", "sql_", ",_", "update", "\\u", "params_", ")_", ",_", "'", "SQL", "'_", ",_", "'\\\\", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "\\u", "cursor_", "._", "execute_", "(_", "update", "\\u", "sql_", ",_", "update", "\\u", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db", "\\u", "connection_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "logger_", "._", "error_", "(_", "e_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db", "\\u", "connection_", "._", "rollback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "unlock", "\\u", "object_", "(_", "tile", "\\u", "pathname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
cread/ecks/ecks/plugins/tcpstats.py
[ { "content": "def get_tcpstats(parent, host, community):\n \"\"\" This is a plugin to be loaded by Ecks\n\n return a list containing [\n tcpAttemptFails, - http://www.oid-info.com/get/1.3.6.1.2.1.6.7\n tcpEstabResets, - http://www.oid-info.com/get/1.3.6.1.2.1.6.8\n tcpCurrEstab - http://www.oid-info.com/get/1.3.6.1.2.1.6.9\n tcpInSegs, - http://www.oid-info.com/get/1.3.6.1.2.1.6.10\n tcpOutSegs, - http://www.oid-info.com/get/1.3.6.1.2.1.6.11\n tcpRetransSegs, - http://www.oid-info.com/get/1.3.6.1.2.1.6.12\n tcpInErrs, - http://www.oid-info.com/get/1.3.6.1.2.1.6.14\n tcpOutRsts, - http://www.oid-info.com/get/1.3.6.1.2.1.6.15\n ]\n\n \"\"\"\n ids = [7, 8, 9, 10, 11, 12, 14, 15]\n\n stats = []\n for id in ids:\n try:\n stats = stats + [long(parent.get_snmp_data(host, community, (1,3,6,1,2,1,6,id), 1)[0][2])]\n except:\n return\n\n return stats", "metadata": "root.get_tcpstats", "header": "['module', '___EOS___']", "index": 22 } ]
[ { "span": "except:", "start_line": 43, "start_column": 8, "end_line": 43, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "tcp", "stats_", "(_", "parent_", ",_", "host_", ",_", "community_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Thi", "s", " ", "is", " ", "a", " ", "plugin", " ", "to", " ", "be", " ", "load", "ed", " ", "by", " ", "Ec", "ks", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "a", " ", "list", " ", "contain", "ing", " ", "[", "\\", "10", ";", " ", " ", " ", " ", "tcp", "Atte", "mpt", "Fail", "s", ",", " ", " ", " ", " ", "-", " ", "http", "://", "www", ".", "oid", "-", "info", ".", "com", "/", "get", "/", "1.3", ".6", ".1", ".2", ".1", ".6", ".7", "\\", "10", ";", " ", " ", " ", " ", "tcp", "Esta", "b", "Reset", "s", ",", " ", "-", " ", "http", "://", "www", ".", "oid", "-", "info", ".", "com", "/", "get", "/", "1.3", ".6", ".1", ".2", ".1", ".6", ".8", "\\", "10", ";", " ", " ", " ", " ", "tcp", "Curr", "Esta", "b", " ", " ", " ", " ", "-", " ", "http", "://", "www", ".", "oid", "-", "info", ".", "com", "/", "get", "/", "1.3", ".6", ".1", ".2", ".1", ".6", ".9", "\\", "10", ";", " ", " ", " ", " ", "tcp", "In", "Seg", "s", ",", " ", " ", "-", " ", "http", "://", "www", ".", "oid", "-", "info", ".", "com", "/", "get", "/", "1.3", ".6", ".1", ".2", ".1", ".6", ".1", "0", "\\", "10", ";", " ", " ", " ", " ", "tcp", "Out", "Seg", "s", ",", " ", " ", " ", " ", " ", "-", " ", "http", "://", "www", ".", "oid", "-", "info", ".", "com", "/", "get", "/", "1.3", ".6", ".1", ".2", ".1", ".6", ".1", "1", "\\", "10", ";", " ", " ", " ", " ", "tcp", "Retr", "ans", "Seg", "s", ",", " ", "-", " ", "http", "://", "www", ".", "oid", "-", "info", ".", "com", "/", "get", "/", "1.3", ".6", ".1", ".2", ".1", ".6", ".12", "\\", "10", ";", " ", " ", " ", " ", "tcp", "In", "Err", "s", ",", " ", " ", "-", " ", "http", "://", "www", ".", "oid", "-", "info", ".", "com", "/", "get", "/", "1.3", ".6", ".1", ".2", ".1", ".6", ".1", "4", "\\", "10", ";", " ", " ", " ", " ", "tcp", "Out", "Rs", "ts", ",", " ", " ", " ", " ", " ", "-", " ", "http", "://", "www", ".", "oid", "-", "info", ".", "com", "/", "get", "/", "1.3", ".6", ".1", ".2", ".1", ".6", ".1", "5", "\\", "10", ";", " ", " ", " ", " ", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ids_", "=_", "[_", "7_", ",_", "8_", ",_", "9_", ",_", "10_", ",_", "11_", ",_", "12_", ",_", "14_", ",_", "15_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stats_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "id_", "in_", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stats_", "=_", "stats_", "+_", "[_", "long_", "(_", "parent_", "._", "get", "\\u", "snmp", "\\u", "data_", "(_", "host_", ",_", "community_", ",_", "(_", "1_", ",_", "3_", ",_", "6_", ",_", "1_", ",_", "2_", ",_", "1_", ",_", "6_", ",_", "id_", ")_", ",_", "1_", ")_", "[_", "0_", "]_", "[_", "2_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "stats_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
algolia/algoliasearch-client-python/algoliasearch/client.py
[ { "content": " def _perform_appengine_request(self, host, path, method, timeout, params=None, data=None):\n \"\"\"\n Perform an HTTPS request with AppEngine's urlfetch. SSL certificate will not validate when \n the request is on a domain which is not a aloglia.net subdomain, a SNI is not available by\n default on GAE. Hence, we do set validate_certificate to False when calling those domains.\n \"\"\"\n method = APPENGINE_METHODS.get(method)\n if isinstance(timeout, tuple):\n timeout = timeout[1]\n url = 'https://%s%s' % (host, path)\n url = params and '%s?%s' %(url, urlencode(urlify(params))) or url\n res = urlfetch.fetch(url=url, method=method, payload=data,\n headers=self.headers, deadline=timeout,\n validate_certificate=host.endswith(SSL_CERTIFICATE_DOMAIN))\n content = res.content != None and json.loads(res.content) or None\n if (int(res.status_code / 100) == 2 and content):\n return content\n elif (int(res.status_code / 100) == 4):\n message = \"HttpCode: %d\" % res.status_code\n if content and content.get('message'):\n message = content['message']\n raise AlgoliaException(message)\n else:\n mesage = '%s Server Error: %s' % (res.status_code, res.content)\n raise Exception(http_error_msg, response=res)", "metadata": "root.Client._perform_appengine_request", "header": "['class', 'Client', '(', 'object', ')', ':', '___EOS___']", "index": 502 } ]
[ { "span": "mesage ", "start_line": 525, "start_column": 12, "end_line": 525, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Client_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "perform", "\\u", "appengine", "\\u", "request_", "(_", "self_", ",_", "host_", ",_", "path_", ",_", "method_", ",_", "timeout_", ",_", "params_", "=_", "None_", ",_", "data_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Perform", " ", "an", " ", "HTTP", "S", " ", "request", " ", "with", " ", "App", "Engine", "'", "s", " ", "urlf", "etch", ".", " ", "SS", "L", " ", "certifica", "te", " ", "will", " ", "not", " ", "validat", "e", " ", "whe", "n", " ", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "request", " ", "is", " ", "on", " ", "a", " ", "domain", " ", "whi", "ch", " ", "is", " ", "not", " ", "a", " ", "alog", "lia", ".", "net", " ", "subdomain", ",", " ", "a", " ", "SNI", " ", "is", " ", "not", " ", "avail", "able", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "default", " ", "on", " ", "GA", "E", ".", " ", "Hen", "ce", ",", " ", "we", " ", "do", " ", "set", " ", "validat", "e\\u", "certifica", "te", " ", "to", " ", "Fal", "se", " ", "whe", "n", " ", "calling", " ", "tho", "se", " ", "domains", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "APPEN", "GIN", "E", "\\u", "METHODS_", "._", "get_", "(_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "timeout_", ",_", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timeout_", "=_", "timeout_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url_", "=_", "'", "https", "://", "%", "s", "%", "s", "'_", "%_", "(_", "host_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "params_", "and_", "'%", "s", "?", "%", "s", "'_", "%_", "(_", "url_", ",_", "urlencode_", "(_", "url", "ify_", "(_", "params_", ")_", ")_", ")_", "or_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "urlf", "etch", "_", "._", "fetch_", "(_", "url_", "=_", "url_", ",_", "method_", "=_", "method_", ",_", "payload_", "=_", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "self_", "._", "headers_", ",_", "deadline_", "=_", "timeout_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "validat", "e\\u", "certificate_", "=_", "host_", "._", "endswith_", "(_", "SS", "L", "\\u", "CERT", "IFIC", "ATE", "\\u", "DOMAIN_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "res_", "._", "content_", "!=_", "None_", "and_", "json_", "._", "loads_", "(_", "res_", "._", "content_", ")_", "or_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "int_", "(_", "res_", "._", "status", "\\u", "code_", "/_", "100_", ")_", "==_", "2_", "and_", "content_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "int_", "(_", "res_", "._", "status", "\\u", "code_", "/_", "100_", ")_", "==_", "4_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "\"", "Http", "Code", ":", " ", "%", "d", "\"_", "%_", "res_", "._", "status", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "content_", "and_", "content_", "._", "get_", "(_", "'", "message", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "content_", "[_", "'", "message", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Algo", "lia", "Exception_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mesa", "ge_", "=_", "'%", "s", " ", "Server", " ", "Error", ":", " ", "%", "s", "'_", "%_", "(_", "res_", "._", "status", "\\u", "code_", ",_", "res_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Exception_", "(_", "http", "\\u", "error", "\\u", "msg_", ",_", "response_", "=_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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hook = sys.excepthook\n fix_print_exception()\n tbi_str = ''\n\n def test():\n raise ValueError('yay fun')\n\n fake_stderr1 = StringIO()\n fake_stderr2 = StringIO()\n sys.stderr = fake_stderr1\n\n try:\n test()\n except:\n _, _, exc_traceback = sys.exc_info()\n tbi = TracebackInfo.from_traceback(exc_traceback)\n exc_info = ExceptionInfo.from_exc_info(*sys.exc_info())\n exc_info2 = ExceptionInfo.from_current()\n tbi_str = str(tbi)\n print_exception(*sys.exc_info(), file=fake_stderr2)\n new_exc_hook_res = fake_stderr2.getvalue()\n builtin_exc_hook(*sys.exc_info())\n builtin_exc_hook_res = fake_stderr1.getvalue()\n finally:\n sys.stderr = sys.__stderr__\n\n # Single frame\n single_frame_str = tbi.frames[-1].tb_frame_str()\n assert 'in test' in single_frame_str\n assert 'yay fun' in single_frame_str\n\n # Traceback info\n assert len(tbi_str.splitlines()) == 5\n assert 'yay fun' in tbi_str\n\n # Full except hook output\n assert 'ValueError: yay fun' in new_exc_hook_res\n assert \"ValueError('yay fun')\" in new_exc_hook_res\n assert len(new_exc_hook_res) > len(tbi_str)\n\n assert new_exc_hook_res == builtin_exc_hook_res", "metadata": "root.test_exception_info", "header": "['module', '___EOS___']", "index": 36 }, { "content": "def test_contextual():\n def func1():\n return func2()\n def func2():\n x = 5\n return func3()\n def func3():\n return ContextualCallpoint.from_current(level=2)\n\n callpoint = func1()\n assert callpoint.func_name == 'func2'\n line = str(callpoint.line)\n assert line.startswith(' ')\n assert line.strip() == 'return func3()'\n assert 'func2' in repr(callpoint)\n\n def func_a():\n a = 1\n raise Exception('func_a exception')\n def func_b():\n b = 2\n return func_a()\n def func_c():\n c = 3\n return func_b()\n\n try:\n func_c()\n except Exception as e:\n ctx_ei = ContextualExceptionInfo.from_current()\n ctx_ei_str = ctx_ei.get_formatted()\n\n ctx_ei_lines = ctx_ei_str.splitlines()\n assert ctx_ei_lines[-1] == 'Exception: func_a exception'\n assert ctx_ei_lines[0] == 'Traceback (most recent call last):'\n assert len(ctx_ei_lines) == 10\n assert \"Exception('func_a exception')\" in ctx_ei_str\n assert ctx_ei.tb_info.frames[2].local_reprs['b'] == '2'", "metadata": "root.test_contextual", "header": "['module', '___EOS___']", "index": 81 } ]
[ { "span": "exc_info ", "start_line": 54, "start_column": 8, "end_line": 54, "end_column": 16 }, { "span": "exc_info2 ", "start_line": 55, "start_column": 8, "end_line": 55, "end_column": 17 }, { "span": "x ", "start_line": 85, "start_column": 8, "end_line": 85, "end_column": 9 }, { "span": "a ", "start_line": 98, "start_column": 8, "end_line": 98, "end_column": 9 }, { "span": "b ", "start_line": 101, "start_column": 8, "end_line": 101, "end_column": 9 }, { "span": "c ", "start_line": 104, "start_column": 8, "end_line": 104, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "exception", "\\u", "info_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "test", " ", "Except", "ion", "Info", " ", "and", " ", "Trace", "back", "Info", " ", "and", " ", "hook", "s", ",", " ", "via", " ", "String", "IO", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bui", "lti", "n", "\\u", "exc", "\\u", "hook_", "=_", "sys_", "._", "except", "hook_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fix", "\\u", "print", "\\u", "exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tb", "i", "\\u", "str_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "ya", "y", " ", "fun", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fake", "\\u", "std", "err", "1_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "std", "err", "2_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stderr_", "=_", "fake", "\\u", "std", "err", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", ",_", "\\u_", ",_", "exc", "\\u", "traceback_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tb", "i_", "=_", "Trace", "back", "Info_", "._", "from", "\\u", "traceback_", "(_", "exc", "\\u", "traceback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exc", "\\u", "info_", "=_", "Except", "ion", "Info_", "._", "from", "\\u", "exc", "\\u", "info_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exc", "\\u", "info", "2_", "=_", "Except", "ion", "Info_", "._", "from", "\\u", "current_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tb", "i", "\\u", "str_", "=_", "str_", "(_", "tb", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "exception_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ",_", "file_", "=_", "fake", "\\u", "std", "err", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "exc", "\\u", "hook", "\\u", "res_", "=_", "fake", "\\u", "std", "err", "2_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bui", "lti", "n", "\\u", "exc", "\\u", "hook_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bui", "lti", "n", "\\u", "exc", "\\u", "hook", "\\u", "res_", "=_", "fake", "\\u", "std", "err", "1_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stderr_", "=_", "sys_", "._", "\\u\\u", "std", "err", "\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sing", "le", " ", "frame_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "single", "\\u", "frame", "\\u", "str_", "=_", "tb", "i_", "._", "frames_", "[_", "-_", "1_", "]_", "._", "tb", "\\u", "frame", "\\u", "str_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "in", " ", "test", "'_", "in_", "single", "\\u", "frame", "\\u", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "ya", "y", " ", "fun", "'_", "in_", "single", "\\u", "frame", "\\u", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Trace", "back", " ", "info_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "tb", "i", "\\u", "str_", "._", "splitlines_", "(_", ")_", ")_", "==_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "ya", "y", " ", "fun", "'_", "in_", "tb", "i", "\\u", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Full", " ", "except", " ", "hook", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "'", "Value", "Error", ":", " ", "ya", "y", " ", "fun", "'_", "in_", "new", "\\u", "exc", "\\u", "hook", "\\u", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "Value", "Error", "('", "ya", "y", " ", "fun", "')\"_", "in_", "new", "\\u", "exc", "\\u", "hook", "\\u", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "new", "\\u", "exc", "\\u", "hook", "\\u", "res_", ")_", ">_", "len_", "(_", "tb", "i", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "new", "\\u", "exc", "\\u", "hook", "\\u", "res_", "==_", "bui", "lti", "n", "\\u", "exc", "\\u", "hook", "\\u", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "context", "ual_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "func", "1_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "func", "2_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "func", "2_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "func", "3_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "func", "3_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Context", "ual", "Call", "point_", "._", "from", "\\u", "current_", "(_", "level_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "call", "point_", "=_", "func", "1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "call", "point_", "._", "func", "\\u", "name_", "==_", "'", "func", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "str_", "(_", "call", "point_", "._", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "line_", "._", "startswith_", "(_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "line_", "._", "strip_", "(_", ")_", "==_", "'", "return", " ", "func", "3", "()'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "func", "2", "'_", "in_", "repr_", "(_", "call", "point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "func", "\\u", "a_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Exception_", "(_", "'", "func", "\\u", "a", " ", "exception", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "func", "\\u", "b_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "func", "\\u", "a_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "func", "\\u", "c_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "func", "\\u", "b_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "func", "\\u", "c_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx", "\\u", "ei_", "=_", "Context", "ual", "Except", "ion", "Info_", "._", "from", "\\u", "current_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx", "\\u", "ei", "\\u", "str_", "=_", "ctx", "\\u", "ei_", "._", "get", "\\u", "formatted_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctx", "\\u", "ei", "\\u", "lines_", "=_", "ctx", "\\u", "ei", "\\u", "str_", "._", "splitlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ctx", "\\u", "ei", "\\u", "lines_", "[_", "-_", "1_", "]_", "==_", "'", "Except", "ion", ":", " ", "func", "\\u", "a", " ", "exception", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ctx", "\\u", "ei", "\\u", "lines_", "[_", "0_", "]_", "==_", "'", "Trace", "back", " ", "(", "most", " ", "recent", " ", "call", " ", "last", "):'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "ctx", "\\u", "ei", "\\u", "lines_", ")_", "==_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "Except", "ion", "('", "func", "\\u", "a", " ", "exception", "')\"_", "in_", "ctx", "\\u", "ei", "\\u", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ctx", "\\u", "ei_", "._", "tb", "\\u", "info_", "._", "frames_", "[_", "2_", "]_", "._", "local", "\\u", "repr", "s_", "[_", "'", "b", "'_", "]_", "==_", "'", "2", "'_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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/optproblems/api.py
[ { "content": "from sellar import SellarProblem, SellarProblemWithDeriv\nfrom branin import BraninProblem\nfrom scalable import UnitScalableProblem\nfrom polyscale import PolyScalableProblem", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from sellar import SellarProblem, SellarProblemWithDeriv", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 56 }, { "span": "from branin import BraninProblem", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 32 }, { "span": "from scalable import UnitScalableProblem", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 40 }, { "span": "from polyscale import PolyScalableProblem", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 41 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "sell", "ar_", "import_", "Sell", "ar", "Problem_", ",_", "Sell", "ar", "Prob", "lem", "With", "Der", "iv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bran", "in_", "import_", "Bra", "nin", "Problem_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scala", "ble_", "import_", "Unit", "Scala", "ble", "Problem_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "polys", "cale_", "import_", "Poly", "Scala", "ble", "Problem_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1 ]
Unused import
ericmoritz/flask-auth/flaskext/auth/tests/backends/mongoengine_auth.py
[ { "content": "from flaskext.auth.backends import mongoengine_auth\nfrom flaskext.auth import utils\nfrom flaskext.auth.tests.backends.base import PasswordBackendMixIn\nfrom flask import (current_app, Flask)\nimport unittest\nfrom mongoengine import connect\nimport os\n\n\napp = Flask(__name__)\n\n\nif raw_input(\"This test alters mongodb's test.users collection, is that ok? [y/n] \").lower() != 'y':\n assert False, \"Can't alter test.users\"\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestMongoengineBackend(PasswordBackendMixIn,unittest.TestCase):\n app = app\n backend = mongoengine_auth.MongoEngineAuth()\n\n\n", "metadata": "root.TestMongoengineBackend", "header": "['module', '___EOS___']", "index": 16 }, { "content": " def setUp(self):\n \n connect(\"test\")\n\n self.user = mongoengine_auth.User(username=\"superuser\")\n self.user.set_password(\"password\")\n self.user.save()", "metadata": "root.TestMongoengineBackend.setUp", "header": "['class', 'TestMongoengineBackend', '(', 'PasswordBackendMixIn', ',', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 20 }, { "content": " def tearDown(self):\n self.user.delete()", "metadata": "root.TestMongoengineBackend.tearDown", "header": "['class', 'TestMongoengineBackend', '(', 'PasswordBackendMixIn', ',', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 29 }, { "content": "class TestUser(unittest.TestCase):\n", "metadata": "root.TestUser", "header": "['module', '___EOS___']", "index": 33 }, { "content": " def test_set_password(self):\n user = mongoengine_auth.User(username=\"superuser\")\n user.set_password(\"password\")\n\n self.assertTrue(utils.check_password(\"password\", user.password))", "metadata": "root.TestUser.test_set_password", "header": "['class', 'TestUser', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 34 }, { "content": " def test_check_password(self):\n user = mongoengine_auth.User(username=\"superuser\")\n user.set_password(\"password\")\n\n self.assertTrue(user.check_password(\"password\"))\n self.assertFalse(user.check_password(\"notpassword\")) ", "metadata": "root.TestUser.test_check_password", "header": "['class', 'TestUser', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 40 } ]
[ { "span": "from flask import (current_app, Flask)", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 38 }, { "span": "import os", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 9 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "fla", "ske", "xt_", "._", "auth_", "._", "backends_", "import_", "mongo", "eng", "ine", "\\u", "auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fla", "ske", "xt_", "._", "auth_", "import_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fla", "ske", "xt_", "._", "auth_", "._", "tests_", "._", "backends_", "._", "base_", "import_", "Passw", "ord", "Back", "end", "Mix", "In_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "import_", "(_", "current", "\\u", "app_", ",_", "Flask_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mongoengine_", "import_", "connect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "=_", "Flask_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "raw", "\\u", "input_", "(_", "\"", "Thi", "s", " ", "test", " ", "alter", "s", " ", "mongodb", "'", "s", " ", "test", ".", "users", " ", "collection", ",", " ", "is", " ", "tha", "t", " ", "ok", "?", " ", "[", "y", "/", "n", "]", " ", "\"_", ")_", "._", "lower_", "(_", ")_", "!=_", "'", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "False_", ",_", "\"", "Can", "'", "t", " ", "alter", " ", "test", ".", "users", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Mon", "go", "eng", "ine", "Backend_", "(_", "Passw", "ord", "Back", "end", "Mix", "In_", ",_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "backend_", "=_", "mongo", "eng", "ine", "\\u", "auth_", "._", "Mon", "go", "Engine", "Auth_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Mon", "go", "eng", "ine", "Backend_", "(_", "Passw", "ord", "Back", "end", "Mix", "In_", ",_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connect_", "(_", "\"", "test", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "user_", "=_", "mongo", "eng", "ine", "\\u", "auth_", "._", "User_", "(_", "username_", "=_", "\"", "super", "user", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "user_", "._", "set\\u", "password_", "(_", "\"", "password", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "user_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Mon", "go", "eng", "ine", "Backend_", "(_", "Passw", "ord", "Back", "end", "Mix", "In_", ",_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "user_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "User_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "User_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "set\\u", "password_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "mongo", "eng", "ine", "\\u", "auth_", "._", "User_", "(_", "username_", "=_", "\"", "super", "user", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "._", "set\\u", "password_", "(_", "\"", "password", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "utils_", "._", "check", "\\u", "password_", "(_", "\"", "password", "\"_", ",_", "user_", "._", "password_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "User_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "check", "\\u", "password_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "mongo", "eng", "ine", "\\u", "auth_", "._", "User_", "(_", "username_", "=_", "\"", "super", "user", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "._", "set\\u", "password_", "(_", "\"", "password", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "user_", "._", "check", "\\u", "password_", "(_", "\"", "password", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "user_", "._", "check", "\\u", "password_", "(_", "\"", "not", "password", "\"_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
tariqdaouda/Mariana/Mariana/wrappers.py
[ { "content": "\tdef run(self, **kwargs) :\n\n\t\tdef _die(fctName, outputLayer, kwargs, exc) :\n\t\t\tsys.stderr.write(\"!!=> Error in function '%s' for layer '%s':\\n\" % (fctName, outputLayer.name))\n\t\t\tsys.stderr.write(\"\\t!!=> the arguments were:\\n %s\\n\" % (kwargs))\n\t\t\traise exc\n\n\t\tself.fctInputs.update(kwargs)\n\t\treturn self.theano_fct(*self.fctInputs.values())", "metadata": "root.TheanoFunction.run", "header": "['class', 'TheanoFunction', '(', 'object', ')', ':', '___EOS___']", "index": 88 } ]
[ { "span": "_die(", "start_line": 90, "start_column": 6, "end_line": 90, "end_column": 10 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "The", "ano", "Function_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "def_", "\\u", "die_", "(_", "fct", "Name_", ",_", "output", "Layer_", ",_", "kwargs_", ",_", "exc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "sys_", "._", "stderr_", "._", "write_", "(_", "\"!!", "=>", " ", "Error", " ", "in", " ", "function", " ", "'%", "s", "'", " ", "for", " ", "layer", " ", "'%", "s", "':", "\\\\", "n", "\"_", "%_", "(_", "fct", "Name_", ",_", "output", "Layer_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stderr_", "._", "write_", "(_", "\"\\\\", "t", "!!", "=>", " ", "the", " ", "argu", "ment", "s", " ", "wer", "e", ":\\\\", "n", " ", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "kwargs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fct", "Inputs_", "._", "update_", "(_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "theano", "\\u", "fct", "_", "(_", "*_", "self_", "._", "fct", "Inputs_", "._", "values_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
thasso/pyjip/jip/templates.py
[ { "content": "@contextfilter\ndef suf_filter(ctx, value, suffix=None):\n try:\n value = __resolve_options(ctx, value)\n if not isinstance(value, Option):\n if not value:\n return \"\"\n v = str(value)\n suffix = suffix if suffix is not None else \"\"\n return \"%s%s\" % (v, suffix)\n\n if value.to_cmd() == \"\":\n return \"\"\n\n v = value.get()\n suffix = suffix if suffix is not None else \"\"\n return \"%s%s\" % (v, suffix)\n except:\n return value", "metadata": "root.suf_filter", "header": "['module', '___EOS___']", "index": 97 }, { "content": "@contextfilter\ndef pre_filter(ctx, value, prefix=None):\n try:\n value = __resolve_options(ctx, value)\n if not isinstance(value, Option):\n if not value:\n return \"\"\n v = str(value)\n prefix = prefix if prefix is not None else \"\"\n return \"%s%s\" % (prefix, v)\n\n if value.to_cmd() == \"\":\n return \"\"\n\n v = value.get()\n prefix = prefix if prefix is not None else value.get_opt()\n return \"%s%s\" % (prefix, v)\n except:\n return value", "metadata": "root.pre_filter", "header": "['module', '___EOS___']", "index": 118 }, { "content": "@contextfilter\ndef arg_filter(ctx, value, prefix=None, suffix=None):\n try:\n value = __resolve_options(ctx, value)\n if not isinstance(value, Option):\n if not value:\n return \"\"\n v = str(value)\n prefix = prefix if prefix is not None else \"\"\n suffix = suffix if suffix is not None else \"\"\n return \"%s%s%s\" % (prefix, v, suffix)\n\n if value.to_cmd() == \"\":\n return \"\"\n\n v = value.get()\n original = prefix\n prefix = prefix if prefix is not None else value.get_opt()\n suffix = suffix if suffix is not None else \"\"\n # we add a space between the prefix and the value if there was\n # no user specified prefix and we used the values get_opt()\n space = \"\" if (original is not None or not v) else \" \"\n return \"%s%s%s%s\" % (prefix, space, v, suffix)\n except:\n return value", "metadata": "root.arg_filter", "header": "['module', '___EOS___']", "index": 139 }, { "content": "@contextfilter\ndef else_filter(ctx, value, prefix=None, suffix=None):\n try:\n value = __resolve_options(ctx, value)\n\n if not isinstance(value, Option):\n if value:\n return value\n prefix = prefix if prefix is not None else \"\"\n suffix = suffix if suffix is not None else \"\"\n return \"%s%s\" % (prefix, suffix)\n\n if value.to_cmd() != \"\":\n return value\n\n v = value.get()\n prefix = prefix if prefix is not None else value.get_opt()\n suffix = suffix if suffix is not None else \"\"\n # we add a space between the prefix and the value iff the prefix is\n # not empty and does not end in space and the value is not empty\n space = \"\" if (prefix == \"\" or v == \"\" or prefix[-1] == \" \") else \" \"\n return \"%s%s%s%s\" % (prefix, space, v, suffix)\n except:\n return value", "metadata": "root.else_filter", "header": "['module', '___EOS___']", "index": 166 }, { "content": "@contextfilter\ndef name_filter(ctx, value):\n if isinstance(value, JipUndefined):\n return \"${%s|name}\" % (value._undefined_name)\n from os.path import basename\n try:\n value = __resolve_options(ctx, value)\n\n if not isinstance(value, Option):\n v = str(value)\n else:\n v = value.get()\n return basename(v)\n except:\n return value", "metadata": "root.name_filter", "header": "['module', '___EOS___']", "index": 192 }, { "content": "@contextfilter\ndef abs_filter(ctx, value, base=None):\n if isinstance(value, JipUndefined):\n return \"${%s|abs}\" % (value._undefined_name)\n try:\n value = __resolve_options(ctx, value)\n\n if not isinstance(value, Option):\n v = str(value)\n else:\n v = value.get()\n if value.source._job is not None:\n base = value.source.job.working_dir\n\n if base is None:\n base = os.getcwd()\n\n if isinstance(v, basestring) and v and len(v) > 0 and\\\n not v.startswith('/'):\n v = os.path.join(os.path.abspath(base), v)\n return v\n except:\n return value", "metadata": "root.abs_filter", "header": "['module', '___EOS___']", "index": 209 }, { "content": "@contextfilter\ndef parent_filter(ctx, value):\n \"\"\"Returns the name of the parent directory of the given file path\n\n :param ctx: the context\n :param value: the file path\n :returns: the name of the parent directory\n \"\"\"\n if isinstance(value, JipUndefined):\n return \"${%s|parent}\" % (value._undefined_name)\n from os.path import dirname\n try:\n value = __resolve_options(ctx, value)\n\n if not isinstance(value, Option):\n v = str(value)\n else:\n v = value.get()\n return dirname(v)\n except:\n return value", "metadata": "root.parent_filter", "header": "['module', '___EOS___']", "index": 234 }, { "content": "@contextfilter\ndef replace_filter(ctx, value, search, replace):\n \"\"\"Replaces all hits of the pattern woth the replacement string\n\n :param ctx: the context\n :param value: the source value\n :param search: the search pattern\n :param replace: the replacement string\n :returns: the new string\n \"\"\"\n if isinstance(value, JipUndefined):\n return \"${%s|re('%s', '%s')}\" % (value._undefined_name,\n search, replace)\n try:\n value = __resolve_options(ctx, value)\n if not isinstance(value, Option):\n v = str(value)\n else:\n v = value.get()\n import re\n return re.sub(search, replace, v)\n except:\n return value", "metadata": "root.replace_filter", "header": "['module', '___EOS___']", "index": 257 }, { "content": "@contextfilter\ndef ext_filter(ctx, value, splitter='.', all=False):\n \"\"\"Cut away the last file extension splitted by `splitter`.\n The default splitter is ``.``\n\n :param ctx: the context\n :param value: the file path\n :param splitter: the splitter\n :param all: if set to True the left-mose occurence of the split character\n is used\n \"\"\"\n try:\n if isinstance(value, JipUndefined):\n return \"${%s|ext('%s')}\" % (value._undefined_name, splitter)\n if not isinstance(value, Option):\n script = ctx.get('tool', None)\n if script:\n v = script.options[value]\n if v is not None:\n value = v\n\n if not isinstance(value, Option):\n v = str(value)\n else:\n v = value.get()\n try:\n if not all:\n i = str(v).rindex(splitter)\n else:\n i = str(v).index(splitter)\n if i > 0:\n return str(v)[:i]\n except:\n pass\n return v\n except:\n return value", "metadata": "root.ext_filter", "header": "['module', '___EOS___']", "index": 282 } ]
[ { "span": "except:", "start_line": 114, "start_column": 4, "end_line": 114, "end_column": 11 }, { "span": "except:", "start_line": 135, "start_column": 4, "end_line": 135, "end_column": 11 }, { "span": "except:", "start_line": 162, "start_column": 4, "end_line": 162, "end_column": 11 }, { "span": "except:", "start_line": 188, "start_column": 4, "end_line": 188, "end_column": 11 }, { "span": "except:", "start_line": 205, "start_column": 4, "end_line": 205, "end_column": 11 }, { "span": "except:", "start_line": 230, "start_column": 4, "end_line": 230, "end_column": 11 }, { "span": "except:", "start_line": 253, "start_column": 4, "end_line": 253, "end_column": 11 }, { "span": "except:", "start_line": 278, "start_column": 4, "end_line": 278, "end_column": 11 }, { "span": "except:", "start_line": 314, "start_column": 8, "end_line": 314, "end_column": 15 }, { "span": "except:", "start_line": 317, "start_column": 4, "end_line": 317, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "context", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "suf", "\\u", "filter_", "(_", "ctx_", ",_", "value_", ",_", "suffix_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "\\u\\u", "resolve", "\\u", "options_", "(_", "ctx_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "value_", ",_", "Option_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "v_", "=_", "str_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suffix_", "=_", "suffix_", "if_", "suffix_", "is_", "not_", "None_", "else_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"%", "s", "%", "s", "\"_", "%_", "(_", "v_", ",_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "._", "to", "\\u", "cmd_", "(_", ")_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "v_", "=_", "value_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suffix_", "=_", "suffix_", "if_", "suffix_", "is_", "not_", "None_", "else_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"%", "s", "%", "s", "\"_", "%_", "(_", "v_", ",_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "context", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "pre", "\\u", "filter_", "(_", "ctx_", ",_", "value_", ",_", "prefix_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "\\u\\u", "resolve", "\\u", "options_", "(_", "ctx_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "value_", ",_", "Option_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "v_", "=_", "str_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefix_", "=_", "prefix_", "if_", "prefix_", "is_", "not_", "None_", "else_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"%", "s", "%", "s", "\"_", "%_", "(_", "prefix_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "._", "to", "\\u", "cmd_", "(_", ")_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "v_", "=_", "value_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefix_", "=_", "prefix_", "if_", "prefix_", "is_", "not_", "None_", "else_", "value_", "._", "get", "\\u", "opt_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"%", "s", "%", "s", "\"_", "%_", "(_", "prefix_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "context", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "arg", "\\u", "filter_", "(_", "ctx_", ",_", "value_", ",_", "prefix_", "=_", "None_", ",_", "suffix_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "\\u\\u", "resolve", "\\u", "options_", "(_", "ctx_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "value_", ",_", "Option_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "v_", "=_", "str_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefix_", "=_", "prefix_", "if_", "prefix_", "is_", "not_", "None_", "else_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suffix_", "=_", "suffix_", "if_", "suffix_", "is_", "not_", "None_", "else_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"%", "s", "%", "s", "%", "s", "\"_", "%_", "(_", "prefix_", ",_", "v_", ",_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "._", "to", "\\u", "cmd_", "(_", ")_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "v_", "=_", "value_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "original_", "=_", "prefix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefix_", "=_", "prefix_", "if_", "prefix_", "is_", "not_", "None_", "else_", "value_", "._", "get", "\\u", "opt_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suffix_", "=_", "suffix_", "if_", "suffix_", "is_", "not_", "None_", "else_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "add", " ", "a", " ", "space", " ", "bet", "ween", " ", "the", " ", "prefix", " ", "and", " ", "the", " ", "value", " ", "if", " ", "there", " ", "was", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "no", " ", "user", " ", "specified", " ", "prefix", " ", "and", " ", "we", " ", "used", " ", "the", " ", "values", " ", "get", "\\u", "opt", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "space_", "=_", "\"\"_", "if_", "(_", "original_", "is_", "not_", "None_", "or_", "not_", "v_", ")_", "else_", "\"", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"%", "s", "%", "s", "%", "s", "%", "s", "\"_", "%_", "(_", "prefix_", ",_", "space_", ",_", "v_", ",_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "context", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "else", "\\u", "filter_", "(_", "ctx_", ",_", "value_", ",_", "prefix_", "=_", "None_", ",_", "suffix_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "\\u\\u", "resolve", "\\u", "options_", "(_", "ctx_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "value_", ",_", "Option_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prefix_", "=_", "prefix_", "if_", "prefix_", "is_", "not_", "None_", "else_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suffix_", "=_", "suffix_", "if_", "suffix_", "is_", "not_", "None_", "else_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"%", "s", "%", "s", "\"_", "%_", "(_", "prefix_", ",_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "._", "to", "\\u", "cmd_", "(_", ")_", "!=_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "v_", "=_", "value_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefix_", "=_", "prefix_", "if_", "prefix_", "is_", "not_", "None_", "else_", "value_", "._", "get", "\\u", "opt_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suffix_", "=_", "suffix_", "if_", "suffix_", "is_", "not_", "None_", "else_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "add", " ", "a", " ", "space", " ", "bet", "ween", " ", "the", " ", "prefix", " ", "and", " ", "the", " ", "value", " ", "iff", " ", "the", " ", "prefix", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "empty", " ", "and", " ", "doe", "s", " ", "not", " ", "end", " ", "in", " ", "space", " ", "and", " ", "the", " ", "value", " ", "is", " ", "not", " ", "empty_", "\\u\\u\\uNL\\u\\u\\u_", "space_", "=_", "\"\"_", "if_", "(_", "prefix_", "==_", "\"\"_", "or_", "v_", "==_", "\"\"_", "or_", "prefix_", "[_", "-_", "1_", "]_", "==_", "\"", " ", "\"_", ")_", "else_", "\"", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"%", "s", "%", "s", "%", "s", "%", "s", "\"_", "%_", "(_", "prefix_", ",_", "space_", ",_", "v_", ",_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "context", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "name", "\\u", "filter_", "(_", "ctx_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "value_", ",_", "Ji", "p", "Unde", "fined", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"$", "{%", "s", "|", "name", "}\"_", "%_", "(_", "value_", "._", "\\u", "undefined", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "os_", "._", "path_", "import_", "basename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "\\u\\u", "resolve", "\\u", "options_", "(_", "ctx_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "value_", ",_", "Option_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "str_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "value_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "basename_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "context", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "abs", "\\u", "filter_", "(_", "ctx_", ",_", "value_", ",_", "base_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "value_", ",_", "Ji", "p", "Unde", "fined", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"$", "{%", "s", "|", "abs", "}\"_", "%_", "(_", "value_", "._", "\\u", "undefined", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "\\u\\u", "resolve", "\\u", "options_", "(_", "ctx_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "value_", ",_", "Option_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "str_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "value_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "._", "source_", "._", "\\u", "job_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base_", "=_", "value_", "._", "source_", "._", "job_", "._", "working", "\\u", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "base_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "v_", ",_", "basestring_", ")_", "and_", "v_", "and_", "len_", "(_", "v_", ")_", ">_", "0_", "and_", "not_", "v_", "._", "startswith_", "(_", "'/'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "base_", ")_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "context", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "parent", "\\u", "filter_", "(_", "ctx_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "name", " ", "of", " ", "the", " ", "parent", " ", "director", "y", " ", "of", " ", "the", " ", "give", "n", " ", "file", " ", "path", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "ctx", ":", " ", "the", " ", "context", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", "the", " ", "file", " ", "path", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "the", " ", "name", " ", "of", " ", "the", " ", "parent", " ", "director", "y", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "Ji", "p", "Unde", "fined", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"$", "{%", "s", "|", "parent", "}\"_", "%_", "(_", "value_", "._", "\\u", "undefined", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "os_", "._", "path_", "import_", "dirname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "\\u\\u", "resolve", "\\u", "options_", "(_", "ctx_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "value_", ",_", "Option_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "str_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "value_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "dirname_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "context", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "replace", "\\u", "filter_", "(_", "ctx_", ",_", "value_", ",_", "search_", ",_", "replace_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Replace", "s", " ", "all", " ", "hits", " ", "of", " ", "the", " ", "pattern", " ", "wo", "th", " ", "the", " ", "replace", "ment", " ", "string", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "ctx", ":", " ", "the", " ", "context", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", "the", " ", "source", " ", "value", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "search", ":", " ", "the", " ", "search", " ", "pattern", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "replace", ":", " ", "the", " ", "replace", "ment", " ", "string", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "the", " ", "new", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "Ji", "p", "Unde", "fined", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"$", "{%", "s", "|", "re", "('", "%", "s", "',", " ", "'%", "s", "')", "}\"_", "%_", "(_", "value_", "._", "\\u", "undefined", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search_", ",_", "replace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "\\u\\u", "resolve", "\\u", "options_", "(_", "ctx_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "value_", ",_", "Option_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "str_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "value_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "re_", "._", "sub_", "(_", "search_", ",_", "replace_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "context", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "ext", "\\u", "filter_", "(_", "ctx_", ",_", "value_", ",_", "splitter_", "=_", "'.'_", ",_", "all_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Cut", " ", "awa", "y", " ", "the", " ", "last", " ", "file", " ", "extensi", "on", " ", "splitted", " ", "by", " ", "`", "splitter", "`.", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "default", " ", "splitter", " ", "is", " ", "``.", "``", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "ctx", ":", " ", "the", " ", "context", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", "the", " ", "file", " ", "path", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "splitter", ":", " ", "the", " ", "splitter", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "all", ":", " ", "if", " ", "set", " ", "to", " ", "Tru", "e", " ", "the", " ", "left", "-", "mos", "e", " ", "occure", "nce", " ", "of", " ", "the", " ", "split", " ", "character", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "used", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "value_", ",_", "Ji", "p", "Unde", "fined", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"$", "{%", "s", "|", "ext", "('", "%", "s", "')", "}\"_", "%_", "(_", "value_", "._", "\\u", "undefined", "\\u", "name_", ",_", "splitter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "value_", ",_", "Option_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "script_", "=_", "ctx_", "._", "get_", "(_", "'", "tool", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "script_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "script_", "._", "options_", "[_", "value_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "v_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "value_", ",_", "Option_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "str_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "value_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "all_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "str_", "(_", "v_", ")_", "._", "rindex", "_", "(_", "splitter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "str_", "(_", "v_", ")_", "._", "index_", "(_", "splitter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "i_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "v_", ")_", "[_", ":_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2 ]
Unused import
mozilla/inventory/api_v2/dhcp_handler.py
[ { "content": "from piston.handler import BaseHandler, rc\nfrom systems.models import System, SystemRack,SystemStatus,NetworkAdapter,KeyValue,ScheduledTask\nfrom truth.models import Truth, KeyValue as TruthKeyValue\nfrom dhcp.DHCP import DHCP as DHCPInterface\nfrom dhcp.models import DHCP\nfrom MacroExpansion import MacroExpansion\nfrom KeyValueTree import KeyValueTree\nimport re\ntry:\n import json\nexcept:\n from django.utils import simplejson as json\nfrom django.test.client import RequestFactory\nfrom settings import API_ACCESS\nfrom api_v2.keyvalue_handler import KeyValueHandler\n\nfactory = RequestFactory()\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class DHCPHandler(BaseHandler):\n allowed_methods = API_ACCESS\n exclude = ()\n\n", "metadata": "root.DHCPHandler", "header": "['module', '___EOS___']", "index": 19 }, { "content": " def read(self, request, dhcp_scope=None, dhcp_action=None):\n if dhcp_scope and dhcp_action == 'get_scopes':\n tasks = []\n for task in ScheduledTask.objects.get_all_dhcp():\n tasks.append(task.task)\n #ScheduledTask.objects.delete_all_dhcp()\n return tasks\n if dhcp_scope and dhcp_action == 'get_scopes_with_names':\n truths = Truth.objects.select_related().filter(keyvalue__key='is_dhcp_scope',keyvalue__value='True').order_by('name')\n\n truth_list = []\n for t in truths:\n truth_list.append({'name':t.name.strip(),'description':t.description.strip()})\n return truth_list\n if dhcp_scope and dhcp_action == 'view_hosts':\n scope_options = []\n h = KeyValueHandler()\n request = factory.get('/api/v2/keyvalue/?key_type=system_by_scope&scope=%s' %\n dhcp_scope, follow=True)\n hosts = h.read(request)\n adapter_list = []\n for host in hosts:\n if 'hostname' in host:\n the_url = '/api/v2/keyvalue/?key_type=adapters_by_system_and_scope&dhcp_scope=%s&system=%s' % (dhcp_scope, host['hostname'])\n try:\n request = factory.get('/api/v2/keyvalue/?key_type=adapters_by_system_and_scope&dhcp_scope=%s&system=%s'\n % (dhcp_scope, host['hostname']))\n adapter_list.append(h.read(request))\n except:\n pass\n d = DHCPInterface(scope_options, adapter_list)\n return d.get_hosts()", "metadata": "root.DHCPHandler.read", "header": "['class', 'DHCPHandler', '(', 'BaseHandler', ')', ':', '___EOS___']", "index": 22 }, { "content": " def create(self, request, dhcp_scope=None, dhcp_action=None):\n if dhcp_scope and dhcp_action == 'add_scheduled_task':\n try:\n task = ScheduledTask(type='dhcp',task=dhcp_scope)\n task.save()\n except Exception, e:\n pass\n #print e\n return rc.ALL_OK\n else:\n return rc.NOT_FOUND", "metadata": "root.DHCPHandler.create", "header": "['class', 'DHCPHandler', '(', 'BaseHandler', ')', ':', '___EOS___']", "index": 55 }, { "content": " def delete(self, request, dhcp_scope=None, dhcp_action=None):\n\n if dhcp_scope and dhcp_action == 'remove_scheduled_task':\n try:\n task = ScheduledTask.objects.get(type='dhcp',task=dhcp_scope)\n task.delete()\n except:\n pass\n return rc.ALL_OK", "metadata": "root.DHCPHandler.delete", "header": "['class', 'DHCPHandler', '(', 'BaseHandler', ')', ':', '___EOS___']", "index": 67 } ]
[ { "span": "from systems.models import System, SystemRack,SystemStatus,NetworkAdapter,KeyValue,ScheduledTask", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 96 }, { "span": "from truth.models import Truth, KeyValue as TruthKeyValue", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 57 }, { "span": "from dhcp.models import DHCP", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 28 }, { "span": "from MacroExpansion import MacroExpansion", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 41 }, { "span": "from KeyValueTree import KeyValueTree", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 37 }, { "span": "import re", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 9 }, { "span": "import json", "start_line": 9, "start_column": 4, "end_line": 9, "end_column": 15 }, { "span": "from django.utils import simplejson as json", "start_line": 11, "start_column": 4, "end_line": 11, "end_column": 47 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "pis", "ton_", "._", "handler_", "import_", "Base", "Handler_", ",_", "rc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "systems_", "._", "models_", "import_", "System_", ",_", "System", "Rack", "_", ",_", "System", "Status_", ",_", "Network", "Adapter_", ",_", "Key", "Value_", ",_", "Schedule", "d", "Task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "truth_", "._", "models_", "import_", "Tru", "th_", ",_", "Key", "Value_", "as_", "Tru", "th", "Key", "Value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dhcp_", "._", "DHC", "P_", "import_", "DHC", "P_", "as_", "DHC", "PI", "nter", "face_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dhcp_", "._", "models_", "import_", "DHC", "P_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Macro", "Expa", "nsion", "_", "import_", "Macro", "Expa", "nsion", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Key", "Value", "Tree_", "import_", "Key", "Value", "Tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "utils_", "import_", "simplejson_", "as_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "django_", "._", "test_", "._", "client_", "import_", "Request", "Factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "settings_", "import_", "API", "\\u", "ACCESS", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "api", "\\u", "v2_", "._", "keyval", "ue", "\\u", "handler_", "import_", "Key", "Value", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "factory_", "=_", "Request", "Factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "DHC", "PH", "andle", "r_", "(_", "Base", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "allow", "ed", "\\u", "methods_", "=_", "API", "\\u", "ACCESS", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exclude_", "=_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "DHC", "PH", "andle", "r_", "(_", "Base", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "request_", ",_", "dhcp", "\\u", "scope_", "=_", "None_", ",_", "dhcp", "\\u", "action_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dhcp", "\\u", "scope_", "and_", "dhcp", "\\u", "action_", "==_", "'", "get", "\\u", "scope", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tasks_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "task_", "in_", "Schedule", "d", "Task_", "._", "objects_", "._", "get", "\\u", "all", "\\u", "dhcp_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tasks_", "._", "append_", "(_", "task_", "._", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Schedule", "d", "Task", ".", "object", "s", ".", "delete", "\\u", "all", "\\u", "dhcp", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "tasks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dhcp", "\\u", "scope_", "and_", "dhcp", "\\u", "action_", "==_", "'", "get", "\\u", "scope", "s", "\\u", "with", "\\u", "names", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "truth", "s_", "=_", "Tru", "th_", "._", "objects_", "._", "select", "\\u", "related_", "(_", ")_", "._", "filter_", "(_", "keyval", "ue", "\\u\\u", "key_", "=_", "'", "is", "\\u", "dhcp", "\\u", "scope", "'_", ",_", "keyval", "ue", "\\u\\u", "value_", "=_", "'", "Tru", "e", "'_", ")_", "._", "order", "\\u", "by_", "(_", "'", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "truth", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "t_", "in_", "truth", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "truth", "\\u", "list_", "._", "append_", "(_", "{_", "'", "name", "'_", ":_", "t_", "._", "name_", "._", "strip_", "(_", ")_", ",_", "'", "description", "'_", ":_", "t_", "._", "description_", "._", "strip_", "(_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "truth", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dhcp", "\\u", "scope_", "and_", "dhcp", "\\u", "action_", "==_", "'", "view", "\\u", "host", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scope", "\\u", "options_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "Key", "Value", "Handler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "factory_", "._", "get_", "(_", "'/", "api", "/", "v2", "/", "keyval", "ue", "/?", "key", "\\u", "type", "=", "system", "\\u", "by", "\\u", "scope", "&", "scope", "=", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "dhcp", "\\u", "scope_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hosts_", "=_", "h_", "._", "read_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "adapter", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "host_", "in_", "hosts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "host", "name", "'_", "in_", "host_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "the", "\\u", "url_", "=_", "'/", "api", "/", "v2", "/", "keyval", "ue", "/?", "key", "\\u", "type", "=", "adapter", "s", "\\u", "by", "\\u", "system", "\\u", "and", "\\u", "scope", "&", "dhcp", "\\u", "scope", "=", "%", "s", "&", "system", "=", "%", "s", "'_", "%_", "(_", "dhcp", "\\u", "scope_", ",_", "host_", "[_", "'", "host", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "request_", "=_", "factory_", "._", "get_", "(_", "'/", "api", "/", "v2", "/", "keyval", "ue", "/?", "key", "\\u", "type", "=", "adapter", "s", "\\u", "by", "\\u", "system", "\\u", "and", "\\u", "scope", "&", "dhcp", "\\u", "scope", "=", "%", "s", "&", "system", "=", "%", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "dhcp", "\\u", "scope_", ",_", "host_", "[_", "'", "host", "name", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "adapter", "\\u", "list_", "._", "append_", "(_", "h_", "._", "read_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d_", "=_", "DHC", "PI", "nter", "face_", "(_", "scope", "\\u", "options_", ",_", "adapter", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "d_", "._", "get", "\\u", "hosts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DHC", "PH", "andle", "r_", "(_", "Base", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create_", "(_", "self_", ",_", "request_", ",_", "dhcp", "\\u", "scope_", "=_", "None_", ",_", "dhcp", "\\u", "action_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dhcp", "\\u", "scope_", "and_", "dhcp", "\\u", "action_", "==_", "'", "add", "\\u", "schedule", "d\\u", "task", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "=_", "Schedule", "d", "Task_", "(_", "type_", "=_", "'", "dhcp", "'_", ",_", "task_", "=_", "dhcp", "\\u", "scope_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "e_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "rc_", "._", "ALL", "\\u", "OK_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "rc_", "._", "NOT", "\\u", "FOUND_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DHC", "PH", "andle", "r_", "(_", "Base", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete_", "(_", "self_", ",_", "request_", ",_", "dhcp", "\\u", "scope_", "=_", "None_", ",_", "dhcp", "\\u", "action_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dhcp", "\\u", "scope_", "and_", "dhcp", "\\u", "action_", "==_", "'", "remove", "\\u", "schedule", "d\\u", "task", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "=_", "Schedule", "d", "Task_", "._", "objects_", "._", "get_", "(_", "type_", "=_", "'", "dhcp", "'_", ",_", "task_", "=_", "dhcp", "\\u", "scope_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "rc_", "._", "ALL", "\\u", "OK_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
An assert statement has a side-effect
beville/ComicStreamer/libs/comictaggerlib/UnRAR2/test_UnRAR2.py
[ { "content": "import os, sys\n\nimport UnRAR2\nfrom UnRAR2.rar_exceptions import *\n\n\n\n\n# basic test\ncleanup()\nrarc = UnRAR2.RarFile('test.rar')\nrarc.infolist()\nassert rarc.comment == \"This is a test.\"\nfor info in rarc.infoiter():\n saveinfo = info\n assert (str(info)==\"\"\"<RarInfo \"test\" in \"test.rar\">\"\"\")\n break\nrarc.extract()\nassert os.path.exists('test'+os.sep+'test.txt')\nassert os.path.exists('test'+os.sep+'this.py')\ndel rarc\nassert (str(saveinfo)==\"\"\"<RarInfo \"test\" in \"[ARCHIVE_NO_LONGER_LOADED]\">\"\"\")\ncleanup()\n\n# extract all the files in test.rar\ncleanup()\nUnRAR2.RarFile('test.rar').extract()\nassert os.path.exists('test'+os.sep+'test.txt')\nassert os.path.exists('test'+os.sep+'this.py')\ncleanup()\n\n# extract all the files in test.rar matching the wildcard *.txt\ncleanup()\nUnRAR2.RarFile('test.rar').extract('*.txt')\nassert os.path.exists('test'+os.sep+'test.txt')\nassert not os.path.exists('test'+os.sep+'this.py')\ncleanup()\n\n\n# check the name and size of each file, extracting small ones\ncleanup()\narchive = UnRAR2.RarFile('test.rar')\nassert archive.comment == 'This is a test.'\narchive.extract(lambda rarinfo: rarinfo.size <= 1024)\nfor rarinfo in archive.infoiter():\n if rarinfo.size <= 1024 and not rarinfo.isdir:\n assert rarinfo.size == os.stat(rarinfo.filename).st_size\nassert file('test'+os.sep+'test.txt', 'rt').read() == 'This is only a test.'\nassert not os.path.exists('test'+os.sep+'this.py')\ncleanup()\n\n\n# extract this.py, overriding it's destination\ncleanup('test2')\narchive = UnRAR2.RarFile('test.rar')\narchive.extract('*.py', 'test2', False)\nassert os.path.exists('test2'+os.sep+'this.py')\ncleanup('test2')\n\n\n# extract test.txt to memory\ncleanup()\narchive = UnRAR2.RarFile('test.rar')\nentries = UnRAR2.RarFile('test.rar').read_files('*test.txt')\nassert len(entries)==1\nassert entries[0][0].filename.endswith('test.txt')\nassert entries[0][1]=='This is only a test.'\n\n\n# extract all the files in test.rar with overwriting\ncleanup()\nfo = open('test'+os.sep+'test.txt',\"wt\")\nfo.write(\"blah\")\nfo.close()\nUnRAR2.RarFile('test.rar').extract('*.txt')\nassert open('test'+os.sep+'test.txt',\"rt\").read()!=\"blah\"\ncleanup()\n\n# extract all the files in test.rar without overwriting\ncleanup()\nfo = open('test'+os.sep+'test.txt',\"wt\")\nfo.write(\"blahblah\")\nfo.close()\nUnRAR2.RarFile('test.rar').extract('*.txt', overwrite = False)\nassert open('test'+os.sep+'test.txt',\"rt\").read()==\"blahblah\"\ncleanup()\n\n# list big file in an archive\nlist(UnRAR2.RarFile('test_nulls.rar').infoiter())\n\n# extract files from an archive with protected files\ncleanup()\nrarc = UnRAR2.RarFile('test_protected_files.rar', password=\"protected\")\nrarc.extract()\nassert os.path.exists('test'+os.sep+'top_secret_xxx_file.txt')\ncleanup()\nerrored = False\ntry:\n UnRAR2.RarFile('test_protected_files.rar', password=\"proteqted\").extract()\nexcept IncorrectRARPassword:\n errored = True\nassert not os.path.exists('test'+os.sep+'top_secret_xxx_file.txt')\nassert errored\ncleanup()\n\n# extract files from an archive with protected headers\ncleanup()\nUnRAR2.RarFile('test_protected_headers.rar', password=\"secret\").extract()\nassert os.path.exists('test'+os.sep+'top_secret_xxx_file.txt')\ncleanup()\nerrored = False\ntry:\n UnRAR2.RarFile('test_protected_headers.rar', password=\"seqret\").extract()\nexcept IncorrectRARPassword:\n errored = True\nassert not os.path.exists('test'+os.sep+'top_secret_xxx_file.txt')\nassert errored\ncleanup()\n\n# make sure docstring examples are working\nimport doctest\ndoctest.testmod(UnRAR2)\n\n# update documentation\nimport pydoc\npydoc.writedoc(UnRAR2)\n\n# cleanup\ntry:\n os.remove('__init__.pyc')\nexcept:\n pass\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "assert open('test'+os.sep+'test.txt',\"rt\").read()!=\"blah\"", "start_line": 81, "start_column": 0, "end_line": 81, "end_column": 57 }, { "span": "assert open('test'+os.sep+'test.txt',\"rt\").read()==\"blahblah\"", "start_line": 90, "start_column": 0, "end_line": 90, "end_column": 61 } ]
[]
1
true
[ "[CLS]_", "An", "_", "assert_", "statement_", "has_", "a_", "side_", "-_", "effect_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", ",_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "Un", "RAR", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Un", "RAR", "2_", "._", "rar", "\\u", "exceptions_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "basic", " ", "test_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cleanup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rar", "c_", "=_", "Un", "RAR", "2_", "._", "Ra", "r", "File_", "(_", "'", "test", ".", "rar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rar", "c_", "._", "infol", "ist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "rar", "c_", "._", "comment_", "==_", "\"", "Thi", "s", " ", "is", " ", "a", " ", "test", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "info_", "in_", "rar", "c_", "._", "info", "iter_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "save", "info_", "=_", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "str_", "(_", "info_", ")_", "==_", "\"\"\"", "<", "Ra", "r", "Info", " ", "\"", "test", "\"", " ", "in", " ", "\"", "test", ".", "rar", "\">", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rar", "c_", "._", "extract_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "os_", "._", "path_", "._", "exists_", "(_", "'", "test", "'_", "+_", "os_", "._", "sep_", "+_", "'", "test", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "os_", "._", "path_", "._", "exists_", "(_", "'", "test", "'_", "+_", "os_", "._", "sep_", "+_", "'", "this", ".", "py", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "rar", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "str_", "(_", "save", "info_", ")_", "==_", "\"\"\"", "<", "Ra", "r", "Info", " ", "\"", "test", "\"", " ", "in", " ", "\"[", "ARCHIVE", "\\u", "NO", "\\u", "LONG", "ER", "\\u", "LOAD", "ED", "]\"", ">\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cleanup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "extract", " ", "all", " ", "the", " ", "files", " ", "in", " ", "test", ".", "rar", "_", "\\u\\u\\uNL\\u\\u\\u_", "cleanup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Un", "RAR", "2_", "._", "Ra", "r", "File_", "(_", "'", "test", ".", "rar", "'_", ")_", "._", "extract_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "os_", "._", "path_", "._", "exists_", "(_", "'", "test", "'_", "+_", "os_", "._", "sep_", "+_", "'", "test", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "os_", "._", "path_", "._", "exists_", "(_", "'", "test", "'_", "+_", "os_", "._", "sep_", "+_", "'", "this", ".", "py", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cleanup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "extract", " ", "all", " ", "the", " ", "files", " ", "in", " ", "test", ".", "rar", " ", "matchi", "ng", " ", "the", " ", "wild", "card", " ", "*.", "txt_", "\\u\\u\\uNL\\u\\u\\u_", "cleanup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Un", "RAR", "2_", "._", "Ra", "r", "File_", "(_", "'", "test", ".", "rar", "'_", ")_", "._", "extract_", "(_", "'*", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "os_", "._", "path_", "._", "exists_", "(_", "'", "test", "'_", "+_", "os_", "._", "sep_", "+_", "'", "test", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "'", "test", "'_", "+_", "os_", "._", "sep_", "+_", "'", "this", ".", "py", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cleanup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "the", " ", "name", " ", "and", " ", "size", " ", "of", " ", "each", " ", "file", ",", " ", "extracti", "ng", " ", "small", " ", "ones_", "\\u\\u\\uNL\\u\\u\\u_", "cleanup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "archive_", "=_", "Un", "RAR", "2_", "._", "Ra", "r", "File_", "(_", "'", "test", ".", "rar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "archive_", "._", "comment_", "==_", "'", "Thi", "s", " ", "is", " ", "a", " ", "test", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "archive_", "._", "extract_", "(_", "lambda_", "rar", "info_", ":_", "rar", "info_", "._", "size_", "<=_", "1024_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "rar", "info_", "in_", "archive_", "._", "info", "iter_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "rar", "info_", "._", "size_", "<=_", "1024_", "and_", "not_", "rar", "info_", "._", "isdir_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "rar", "info_", "._", "size_", "==_", "os_", "._", "stat_", "(_", "rar", "info_", "._", "filename_", ")_", "._", "st", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "file_", "(_", "'", "test", "'_", "+_", "os_", "._", "sep_", "+_", "'", "test", ".", "txt", "'_", ",_", "'", "rt", "'_", ")_", "._", "read_", "(_", ")_", "==_", "'", "Thi", "s", " ", "is", " ", "only", " ", "a", " ", "test", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "'", "test", "'_", "+_", "os_", "._", "sep_", "+_", "'", "this", ".", "py", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cleanup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "extract", " ", "this", ".", "py", ",", " ", "overrid", "ing", " ", "it", "'", "s", " ", "destination_", "\\u\\u\\uNL\\u\\u\\u_", "cleanup_", "(_", "'", "test", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "archive_", "=_", "Un", "RAR", "2_", "._", "Ra", "r", "File_", "(_", "'", "test", ".", "rar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "archive_", "._", "extract_", "(_", "'*", ".", "py", "'_", ",_", "'", "test", "2", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "os_", "._", "path_", "._", "exists_", "(_", "'", "test", "2", "'_", "+_", "os_", "._", "sep_", "+_", "'", "this", ".", "py", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cleanup_", "(_", "'", "test", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "extract", " ", "test", ".", "txt", " ", "to", " ", "memory_", "\\u\\u\\uNL\\u\\u\\u_", "cleanup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "archive_", "=_", "Un", "RAR", "2_", "._", "Ra", "r", "File_", "(_", "'", "test", ".", "rar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entries_", "=_", "Un", "RAR", "2_", "._", "Ra", "r", "File_", "(_", "'", "test", ".", "rar", "'_", ")_", "._", "read", "\\u", "files_", "(_", "'*", "test", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "entries_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "entries_", "[_", "0_", "]_", "[_", "0_", "]_", "._", "filename_", "._", "endswith_", "(_", "'", "test", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "entries_", "[_", "0_", "]_", "[_", "1_", "]_", "==_", "'", "Thi", "s", " ", "is", " ", "only", " ", "a", " ", "test", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "extract", " ", "all", " ", "the", " ", "files", " ", "in", " ", "test", ".", "rar", " ", "with", " ", "overwrit", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "cleanup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fo_", "=_", "open_", "(_", "'", "test", "'_", "+_", "os_", "._", "sep_", "+_", "'", "test", ".", "txt", "'_", ",_", "\"", "wt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fo_", "._", "write_", "(_", "\"", "bla", "h", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fo_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Un", "RAR", "2_", "._", "Ra", "r", "File_", "(_", "'", "test", ".", "rar", "'_", ")_", "._", "extract_", "(_", "'*", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "open_", "(_", "'", "test", "'_", "+_", "os_", "._", "sep_", "+_", "'", "test", ".", "txt", "'_", ",_", "\"", "rt", "\"_", ")_", "._", "read_", "(_", ")_", "!=_", "\"", "bla", "h", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cleanup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "extract", " ", "all", " ", "the", " ", "files", " ", "in", " ", "test", ".", "rar", " ", "with", "out", " ", "overwrit", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "cleanup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fo_", "=_", "open_", "(_", "'", "test", "'_", "+_", "os_", "._", "sep_", "+_", "'", "test", ".", "txt", "'_", ",_", "\"", "wt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fo_", "._", "write_", "(_", "\"", "bla", "hb", "lah", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fo_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Un", "RAR", "2_", "._", "Ra", "r", "File_", "(_", "'", "test", ".", "rar", "'_", ")_", "._", "extract_", "(_", "'*", ".", "txt", "'_", ",_", "overwrite_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "open_", "(_", "'", "test", "'_", "+_", "os_", "._", "sep_", "+_", "'", "test", ".", "txt", "'_", ",_", "\"", "rt", "\"_", ")_", "._", "read_", "(_", ")_", "==_", "\"", "bla", "hb", "lah", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cleanup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "list", " ", "big", " ", "file", " ", "in", " ", "an", " ", "archive_", "\\u\\u\\uNL\\u\\u\\u_", "list_", "(_", "Un", "RAR", "2_", "._", "Ra", "r", "File_", "(_", "'", "test\\u", "null", "s", ".", "rar", "'_", ")_", "._", "info", "iter_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "extract", " ", "files", " ", "from", " ", "an", " ", "archive", " ", "with", " ", "protect", "ed", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "cleanup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rar", "c_", "=_", "Un", "RAR", "2_", "._", "Ra", "r", "File_", "(_", "'", "test\\u", "protect", "ed", "\\u", "files", ".", "rar", "'_", ",_", "password_", "=_", "\"", "protect", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rar", "c_", "._", "extract_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "os_", "._", "path_", "._", "exists_", "(_", "'", "test", "'_", "+_", "os_", "._", "sep_", "+_", "'", "top", "\\u", "secret", "\\u", "xxx", "\\u", "file", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cleanup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errore", "d_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Un", "RAR", "2_", "._", "Ra", "r", "File_", "(_", "'", "test\\u", "protect", "ed", "\\u", "files", ".", "rar", "'_", ",_", "password_", "=_", "\"", "prote", "qt", "ed", "\"_", ")_", "._", "extract_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Inco", "rrect", "RAR", "Password_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errore", "d_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "'", "test", "'_", "+_", "os_", "._", "sep_", "+_", "'", "top", "\\u", "secret", "\\u", "xxx", "\\u", "file", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "errore", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cleanup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "extract", " ", "files", " ", "from", " ", "an", " ", "archive", " ", "with", " ", "protect", "ed", " ", "headers_", "\\u\\u\\uNL\\u\\u\\u_", "cleanup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Un", "RAR", "2_", "._", "Ra", "r", "File_", "(_", "'", "test\\u", "protect", "ed", "\\u", "header", "s", ".", "rar", "'_", ",_", "password_", "=_", "\"", "secret", "\"_", ")_", "._", "extract_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "os_", "._", "path_", "._", "exists_", "(_", "'", "test", "'_", "+_", "os_", "._", "sep_", "+_", "'", "top", "\\u", "secret", "\\u", "xxx", "\\u", "file", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cleanup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errore", "d_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Un", "RAR", "2_", "._", "Ra", "r", "File_", "(_", "'", "test\\u", "protect", "ed", "\\u", "header", "s", ".", "rar", "'_", ",_", "password_", "=_", "\"", "seq", "ret", "\"_", ")_", "._", "extract_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Inco", "rrect", "RAR", "Password_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errore", "d_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "'", "test", "'_", "+_", "os_", "._", "sep_", "+_", "'", "top", "\\u", "secret", "\\u", "xxx", "\\u", "file", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "errore", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cleanup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "docstr", "ing", " ", "example", "s", " ", "are", " ", "working", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "doctest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doctest_", "._", "testmod_", "(_", "Un", "RAR", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", " ", "documentation", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pydo", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pydo", "c_", "._", "write", "doc_", "(_", "Un", "RAR", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cleanup_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "'\\u", "\\u", "init", "\\u\\u", ".", "pyc", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
CouchPotato/CouchPotatoServer/libs/git/__init__.py
[ { "content": "# Copyright (c) 2009, Rotem Yaari <[email protected]>\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are met:\n# * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n# * Redistributions in binary form must reproduce the above copyright\n# notice, this list of conditions and the following disclaimer in the\n# documentation and/or other materials provided with the distribution.\n# * Neither the name of organization nor the\n# names of its contributors may be used to endorse or promote products\n# derived from this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY Rotem Yaari ''AS IS'' AND ANY\n# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n# DISCLAIMED. IN NO EVENT SHALL Rotem Yaari BE LIABLE FOR ANY\n# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\nfrom repository import RemoteRepository\nfrom repository import LocalRepository\nfrom repository import clone\nfrom repository import find_repository\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from repository import RemoteRepository", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 39 }, { "span": "from repository import LocalRepository", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 38 }, { "span": "from repository import clone", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 28 }, { "span": "from repository import find_repository", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 38 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "200", "9", ",", " ", "Rot", "em", " ", "Ya", "ari", " ", "<", "vma", "lloc", "@", "gma", "il", ".", "com", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyright_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyright_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "organization", " ", "nor", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "names", " ", "of", " ", "its", " ", "contributor", "s", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or", " ", "promote", " ", "products_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "derive", "d", " ", "from", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior", " ", "writt", "en", " ", "permissi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "Rot", "em", " ", "Ya", "ari", " ", "''", "AS", " ", "IS", "''", " ", "AND", " ", "ANY_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "THE", " ", "IMPL", "IED", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "ARE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "Rot", "em", " ", "Ya", "ari", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "from_", "repository_", "import_", "Remo", "te", "Repository_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "repository_", "import_", "Local", "Repository_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "repository_", "import_", "clone_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "repository_", "import_", "find", "\\u", "repository_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1 ]
Unreachable code
lsaffre/lino/lino/utils/mti.py
[ { "content": "def delete_child(obj, child_model, ar=None, using=None):\n \"\"\"\n Delete the `child_model` instance related to `obj` without\n deleting the parent `obj` itself.\n \"\"\"\n # logger.info(u\"delete_child %s from %s\",child_model.__name__,obj)\n using = using or router.db_for_write(obj.__class__, instance=obj)\n child = get_child(obj, child_model)\n if child is None:\n raise Exception(\"%s has no child in %s\" % (obj, child_model.__name__))\n\n # msg = child.disable_delete(ar)\n ignore_models = set()\n # for m in models_by_base(obj.__class__):\n # ignore_models.remove(child_model)\n msg = child._lino_ddh.disable_delete_on_object(\n obj, ignore_models)\n if msg:\n raise ValidationError(msg)\n # logger.debug(u\"Delete child %s from %s\",child_model.__name__,obj)\n if True:\n collector = ChildCollector(using=using)\n collector.collect([child])\n # raise Exception(repr(collector.data))\n # model = obj.__class__\n\n # remove the collected MTI parents so they are not deleted\n # (this idea didnt work: yes the parents were saved, but not\n # their related objects).\n\n # concrete_model = child_model._meta.concrete_model\n # for ptr in six.itervalues(concrete_model._meta.parents):\n # if ptr:\n # # raise Exception(repr(ptr.rel.model))\n # del collector.data[ptr.rel.model]\n\n else:\n collector = ChildCollector(using=using)\n collector.collect([child], source=obj.__class__,\n nullable=True, collect_parents=False)\n collector.delete()\n\n #~ setattr(obj,child_model.__name__.lower(),None)\n #~ delattr(obj,child_model.__name__.lower())\n\n # TODO: unchecking e.g. Company.is_courseprovider deletes the\n # child when saving the form, but the response to the PUT returns\n # still a True value because it works on the same memory instance\n # (`obj`). User sees the effect only after clicking the refresh\n # button. Fortunately there's no problem if the user unchecks the\n # field and saves the form a second time.", "metadata": "root.delete_child", "header": "['module', '___EOS___']", "index": 124 }, { "content": " def __init__(self, child_model, **kw):\n raise Exception(\"No longer recommended. \"\n \"Use `lino.mixins.polymorphic` instead.\")\n kw.update(default=False)\n self.child_model = child_model\n VirtualField.__init__(self, models.BooleanField(**kw), self.has_child)", "metadata": "root.EnableChild.__init__", "header": "['class', 'EnableChild', '(', 'VirtualField', ')', ':', '___EOS___']", "index": 244 } ]
[ { "span": "collector = ChildCollector(using=using)", "start_line": 161, "start_column": 8, "end_line": 161, "end_column": 47 }, { "span": "kw.update(default=False)", "start_line": 247, "start_column": 8, "end_line": 247, "end_column": 32 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "child_", "(_", "obj_", ",_", "child", "\\u", "model_", ",_", "ar_", "=_", "None_", ",_", "using_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Delete", " ", "the", " ", "`", "child", "\\u", "model", "`", " ", "instance", " ", "relate", "d", " ", "to", " ", "`", "obj", "`", " ", "with", "out", "\\", "10", ";", " ", " ", " ", " ", "delet", "ing", " ", "the", " ", "parent", " ", "`", "obj", "`", " ", "its", "elf", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "logg", "er", ".", "info", "(", "u", "\"", "delete", "\\u", "child", " ", "%", "s", " ", "from", " ", "%", "s", "\",", "child", "\\u", "model", ".\\u", "\\u", "name", "\\u\\u", ",", "obj", ")_", "\\u\\u\\uNL\\u\\u\\u_", "using_", "=_", "using_", "or_", "router_", "._", "db", "\\u", "for", "\\u", "write_", "(_", "obj_", "._", "\\u\\u", "class\\u\\u_", ",_", "instance_", "=_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "child_", "=_", "get", "\\u", "child_", "(_", "obj_", ",_", "child", "\\u", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "child_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"%", "s", " ", "has", " ", "no", " ", "child", " ", "in", " ", "%", "s", "\"_", "%_", "(_", "obj_", ",_", "child", "\\u", "model_", "._", "\\u\\u", "name\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "msg", " ", "=", " ", "child", ".", "disable", "\\u", "delete", "(", "ar", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ignore", "\\u", "models_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "for", " ", "m", " ", "in", " ", "model", "s", "\\u", "by", "\\u", "base", "(", "obj", ".\\u", "\\u", "class", "\\u\\u)", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ignore", "\\u", "model", "s", ".", "remove", "(", "child", "\\u", "model", ")_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "child_", "._", "\\u", "lino", "\\u", "dd", "h_", "._", "disable", "\\u", "delete", "\\u", "on", "\\u", "object_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", ",_", "ignore", "\\u", "models_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "logg", "er", ".", "debug", "(", "u", "\"", "Delete", " ", "child", " ", "%", "s", " ", "from", " ", "%", "s", "\",", "child", "\\u", "model", ".\\u", "\\u", "name", "\\u\\u", ",", "obj", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "collector_", "=_", "Chil", "d", "Collector_", "(_", "using_", "=_", "using_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "collector_", "._", "collect_", "(_", "[_", "child_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "raise", " ", "Except", "ion", "(", "repr", "(", "collect", "or", ".", "data", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "model", " ", "=", " ", "obj", ".\\u", "\\u", "class\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", "the", " ", "collected", " ", "MT", "I", " ", "parents", " ", "so", " ", "the", "y", " ", "are", " ", "not", " ", "deleted_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "this", " ", "idea", " ", "did", "nt", " ", "work", ":", " ", "ye", "s", " ", "the", " ", "parents", " ", "wer", "e", " ", "saved", ",", " ", "but", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "thei", "r", " ", "relate", "d", " ", "object", "s", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "concre", "te", "\\u", "model", " ", "=", " ", "child", "\\u", "model", ".\\u", "meta", ".", "concre", "te", "\\u", "model_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "ptr", " ", "in", " ", "si", "x", ".", "iter", "values", "(", "concre", "te", "\\u", "model", ".\\u", "meta", ".", "parents", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "ptr", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "#", " ", "raise", " ", "Except", "ion", "(", "repr", "(", "ptr", ".", "rel", ".", "model", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "del", " ", "collect", "or", ".", "data", "[", "ptr", ".", "rel", ".", "model", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "collector_", "=_", "Chil", "d", "Collector_", "(_", "using_", "=_", "using_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "collector_", "._", "collect_", "(_", "[_", "child_", "]_", ",_", "source_", "=_", "obj_", "._", "\\u\\u", "class\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nullable_", "=_", "True_", ",_", "collect", "\\u", "parents_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "collector_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "~", " ", "setattr", "(", "obj", ",", "child", "\\u", "model", ".\\u", "\\u", "name", "\\u\\u", ".", "lower", "()", ",", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "~", " ", "delattr", "(", "obj", ",", "child", "\\u", "model", ".\\u", "\\u", "name", "\\u\\u", ".", "lower", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "uncheck", "ing", " ", "e", ".", "g", ".", " ", "Compa", "ny", ".", "is", "\\u", "course", "provide", "r", " ", "delete", "s", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "child", " ", "whe", "n", " ", "saving", " ", "the", " ", "form", ",", " ", "but", " ", "the", " ", "response", " ", "to", " ", "the", " ", "PU", "T", " ", "returns_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "still", " ", "a", " ", "Tru", "e", " ", "value", " ", "bec", "aus", "e", " ", "it", " ", "works", " ", "on", " ", "the", " ", "same", " ", "memory", " ", "instance_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "`", "obj", "`)", ".", " ", " ", "User", " ", "see", "s", " ", "the", " ", "effect", " ", "only", " ", "after", " ", "click", "ing", " ", "the", " ", "refresh_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "button", ".", " ", " ", "Fort", "unat", "el", "y", " ", "there", "'", "s", " ", "no", " ", "problem", " ", "if", " ", "the", " ", "user", " ", "uncheck", "s", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "field", " ", "and", " ", "save", "s", " ", "the", " ", "form", " ", "a", " ", "second", " ", "time", "._", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Enable", "Child_", "(_", "Virt", "ual", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "child", "\\u", "model_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "No", " ", "long", "er", " ", "recommende", "d", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Us", "e", " ", "`", "lino", ".", "mix", "ins", ".", "polymorphic", "`", " ", "inst", "ead", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kw_", "._", "update_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "child", "\\u", "model_", "=_", "child", "\\u", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Virt", "ual", "Field_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "models_", "._", "Boo", "lean", "Field_", "(_", "**_", "kw_", ")_", ",_", "self_", "._", "has", "\\u", "child_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
posborne/mlcollection/mlcollection/lib/reinforcement/reinforcement_learning_example.py
[ { "content": "'''\nCreated on Mar 22, 2010\n@author: Zachary Varberg\n'''\n\nfrom numpy import *\nimport scipy as Sci\nimport scipy.linalg\nimport copy\nimport matplotlib.pyplot as pyplot\n\n\nif __name__ == \"__main__\":\n rl = simple_RL((25,25),.05,.95,(7,6))\n rl.run(1000)\n print rl.Q_mat\n ", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class simple_RL(object):\n \n \n \n ", "metadata": "root.simple_RL", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def __init__(self, num_states, alpha, gamma, goal_state):\n self.num_states = num_states\n self.alpha = alpha\n self.gamma = gamma\n self.num_actions = 4\n self.Q_mat = zeros((self.num_states[0]*self.num_states[1], self.num_actions))\n self.goal_state = goal_state\n self.trans_dict={0:(0,-1),1:(1,1),2:(0,1),3:(1,-1)}\n self.start_state = [random.randint(0,num_states[0]),random.randint(0,num_states[1])]\n self.curr_state = self.start_state", "metadata": "root.simple_RL.__init__", "header": "['class', 'simple_RL', '(', 'object', ')', ':', '___EOS___']", "index": 13 }, { "content": " def execute_action(self, action):\n move = self.trans_dict[action]\n prev_state = copy.deepcopy(self.curr_state)\n self.curr_state[move[0]] = min(max(self.curr_state[move[0]] + move[1],0),self.num_states[move[0]]-1)\n r = self.get_reward(self.curr_state)\n self.Q_mat[self.num_states[0]*(prev_state[0]) + prev_state[1],action] = (\n self.Q_mat[self.num_states[0]*(prev_state[0]) + prev_state[1],action]*(1-self.alpha) +\n (r + self.gamma*max(self.Q_mat[self.num_states[0]*(self.curr_state[0]) + (self.curr_state[1])]))*self.alpha)\n if tuple(self.curr_state) == self.goal_state:\n return True\n return False", "metadata": "root.simple_RL.execute_action", "header": "['class', 'simple_RL', '(', 'object', ')', ':', '___EOS___']", "index": 24 }, { "content": " def get_reward(self, state):\n if tuple(state) == self.goal_state:\n return 10\n return -1", "metadata": "root.simple_RL.get_reward", "header": "['class', 'simple_RL', '(', 'object', ')', ':', '___EOS___']", "index": 36 }, { "content": " def run(self, num_trials):\n tot_reward = []\n tot_steps = []\n tri_reward = 0\n num_steps = 0\n for x in xrange(num_trials):\n if x%10==0 and x>=10:\n print 'Trial',x,(sum(tot_reward[x-10:x])/10),(sum(tot_steps[x-10:x])/10)\n self.curr_state = [random.randint(0,self.num_states[0]),random.randint(0,self.num_states[1])]\n #self.curr_state = [0,0]\n tri_reward = 0\n num_steps = 0\n not_done = True\n path = []\n while(not_done):\n num_steps+=1\n best_action = nonzero(self.Q_mat[self.num_states[0]*(self.curr_state[0]) + (self.curr_state[1])]==max(self.Q_mat[self.num_states[0]*(self.curr_state[0]) + (self.curr_state[1])]))[0]\n next_action = best_action[random.randint(0,len(best_action))] if random.random() <.9 else random.randint(0,self.num_actions)\n not_done = not self.execute_action(next_action)\n tri_reward += self.get_reward(self.curr_state)\n path.append(copy.deepcopy(self.curr_state))\n tot_reward.append(tri_reward)\n tot_steps.append(num_steps)\n fig1 = pyplot.figure(1)\n# pyplot.plot(xrange(num_trials),[(sum(tot_reward[x-100:x])/100) if x >=100 else (sum(tot_reward[0:x])/x) for x in xrange(num_trials)],'r--',xrange(num_trials),[(sum(tot_steps[x-100:x])/100) if x >=100 else (sum(tot_steps[0:x])/x) for x in xrange(num_trials)],'b--')\n pyplot.plot([(sum(tot_reward[x-100:x])/100) if x >=100 else (sum(tot_reward[0:x])/x) for x in xrange(num_trials)])\n fig1.suptitle(\"Rewards\")\n fig2 = pyplot.figure(2)\n pyplot.plot([(sum(tot_steps[x-100:x])/100) if x >=100 else (sum(tot_steps[0:x])/x) for x in xrange(num_trials)])\n fig2.suptitle(\"Steps\")\n pyplot.show()", "metadata": "root.simple_RL.run", "header": "['class', 'simple_RL', '(', 'object', ')', ':', '___EOS___']", "index": 41 } ]
[ { "span": "import scipy as Sci", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 19 }, { "span": "import scipy.linalg", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 19 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "'''", "\\", "10", ";", "Creat", "ed", " ", "on", " ", "Mar", " ", "2", "2", ",", " ", "2010", "\\", "10", ";", "@", "author", ":", " ", "Za", "char", "y", " ", "Var", "ber", "g", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "numpy_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "scipy_", "as_", "Sci", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "scipy_", "._", "linalg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "matplotlib_", "._", "pyplot_", "as_", "pyplot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rl_", "=_", "simple", "\\u", "RL", "_", "(_", "(_", "25_", ",_", "25_", ")_", ",_", ".05_", ",_", ".95", "_", ",_", "(_", "7_", ",_", "6_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rl_", "._", "run_", "(_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "rl_", "._", "Q", "\\u", "mat_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "simple", "\\u", "RL", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "simple", "\\u", "RL", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "num", "\\u", "states_", ",_", "alpha_", ",_", "gamma_", ",_", "goal", "\\u", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "num", "\\u", "states_", "=_", "num", "\\u", "states_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "alpha_", "=_", "alpha_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "gamma_", "=_", "gamma_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "num", "\\u", "actions_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Q", "\\u", "mat_", "=_", "zeros_", "(_", "(_", "self_", "._", "num", "\\u", "states_", "[_", "0_", "]_", "*_", "self_", "._", "num", "\\u", "states_", "[_", "1_", "]_", ",_", "self_", "._", "num", "\\u", "actions_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "goal", "\\u", "state_", "=_", "goal", "\\u", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "trans", "\\u", "dict_", "=_", "{_", "0_", ":_", "(_", "0_", ",_", "-_", "1_", ")_", ",_", "1_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "2_", ":_", "(_", "0_", ",_", "1_", ")_", ",_", "3_", ":_", "(_", "1_", ",_", "-_", "1_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "start", "\\u", "state_", "=_", "[_", "random_", "._", "randint_", "(_", "0_", ",_", "num", "\\u", "states_", "[_", "0_", "]_", ")_", ",_", "random_", "._", "randint_", "(_", "0_", ",_", "num", "\\u", "states_", "[_", "1_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "curr", "\\u", "state_", "=_", "self_", "._", "start", "\\u", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "simple", "\\u", "RL", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute", "\\u", "action_", "(_", "self_", ",_", "action_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "move_", "=_", "self_", "._", "trans", "\\u", "dict_", "[_", "action_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev", "\\u", "state_", "=_", "copy_", "._", "deepcopy_", "(_", "self_", "._", "curr", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "curr", "\\u", "state_", "[_", "move_", "[_", "0_", "]_", "]_", "=_", "min_", "(_", "max_", "(_", "self_", "._", "curr", "\\u", "state_", "[_", "move_", "[_", "0_", "]_", "]_", "+_", "move_", "[_", "1_", "]_", ",_", "0_", ")_", ",_", "self_", "._", "num", "\\u", "states_", "[_", "move_", "[_", "0_", "]_", "]_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "self_", "._", "get", "\\u", "reward_", "(_", "self_", "._", "curr", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Q", "\\u", "mat_", "[_", "self_", "._", "num", "\\u", "states_", "[_", "0_", "]_", "*_", "(_", "prev", "\\u", "state_", "[_", "0_", "]_", ")_", "+_", "prev", "\\u", "state_", "[_", "1_", "]_", ",_", "action_", "]_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Q", "\\u", "mat_", "[_", "self_", "._", "num", "\\u", "states_", "[_", "0_", "]_", "*_", "(_", "prev", "\\u", "state_", "[_", "0_", "]_", ")_", "+_", "prev", "\\u", "state_", "[_", "1_", "]_", ",_", "action_", "]_", "*_", "(_", "1_", "-_", "self_", "._", "alpha_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r_", "+_", "self_", "._", "gamma_", "*_", "max_", "(_", "self_", "._", "Q", "\\u", "mat_", "[_", "self_", "._", "num", "\\u", "states_", "[_", "0_", "]_", "*_", "(_", "self_", "._", "curr", "\\u", "state_", "[_", "0_", "]_", ")_", "+_", "(_", "self_", "._", "curr", "\\u", "state_", "[_", "1_", "]_", ")_", "]_", ")_", ")_", "*_", "self_", "._", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tuple_", "(_", "self_", "._", "curr", "\\u", "state_", ")_", "==_", "self_", "._", "goal", "\\u", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "simple", "\\u", "RL", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "reward_", "(_", "self_", ",_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "tuple_", "(_", "state_", ")_", "==_", "self_", "._", "goal", "\\u", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "simple", "\\u", "RL", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "num", "\\u", "trials_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tot", "\\u", "reward_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tot", "\\u", "steps_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tri", "\\u", "reward_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "steps_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "xrange_", "(_", "num", "\\u", "trials_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "%_", "10_", "==_", "0_", "and_", "x_", ">=_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Trial", "'_", ",_", "x_", ",_", "(_", "sum_", "(_", "tot", "\\u", "reward_", "[_", "x_", "-_", "10_", ":_", "x_", "]_", ")_", "/_", "10_", ")_", ",_", "(_", "sum_", "(_", "tot", "\\u", "steps_", "[_", "x_", "-_", "10_", ":_", "x_", "]_", ")_", "/_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "curr", "\\u", "state_", "=_", "[_", "random_", "._", "randint_", "(_", "0_", ",_", "self_", "._", "num", "\\u", "states_", "[_", "0_", "]_", ")_", ",_", "random_", "._", "randint_", "(_", "0_", ",_", "self_", "._", "num", "\\u", "states_", "[_", "1_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "curr", "\\u", "state", " ", "=", " ", "[", "0", ",", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "tri", "\\u", "reward_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "steps_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "not", "\\u", "done_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "(_", "not", "\\u", "done_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "steps_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "action_", "=_", "nonzero_", "(_", "self_", "._", "Q", "\\u", "mat_", "[_", "self_", "._", "num", "\\u", "states_", "[_", "0_", "]_", "*_", "(_", "self_", "._", "curr", "\\u", "state_", "[_", "0_", "]_", ")_", "+_", "(_", "self_", "._", "curr", "\\u", "state_", "[_", "1_", "]_", ")_", "]_", "==_", "max_", "(_", "self_", "._", "Q", "\\u", "mat_", "[_", "self_", "._", "num", "\\u", "states_", "[_", "0_", "]_", "*_", "(_", "self_", "._", "curr", "\\u", "state_", "[_", "0_", "]_", ")_", "+_", "(_", "self_", "._", "curr", "\\u", "state_", "[_", "1_", "]_", ")_", "]_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "\\u", "action_", "=_", "best", "\\u", "action_", "[_", "random_", "._", "randint_", "(_", "0_", ",_", "len_", "(_", "best", "\\u", "action_", ")_", ")_", "]_", "if_", "random_", "._", "random_", "(_", ")_", "<_", ".9_", "else_", "random_", "._", "randint_", "(_", "0_", ",_", "self_", "._", "num", "\\u", "actions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "not", "\\u", "done_", "=_", "not_", "self_", "._", "execute", "\\u", "action_", "(_", "next", "\\u", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tri", "\\u", "reward_", "+=_", "self_", "._", "get", "\\u", "reward_", "(_", "self_", "._", "curr", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "._", "append_", "(_", "copy_", "._", "deepcopy_", "(_", "self_", "._", "curr", "\\u", "state_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tot", "\\u", "reward_", "._", "append_", "(_", "tri", "\\u", "reward_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tot", "\\u", "steps_", "._", "append_", "(_", "num", "\\u", "steps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fig", "1_", "=_", "pyplot_", "._", "figure_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "pypl", "ot", ".", "plot", "(", "xran", "ge", "(", "num", "\\u", "tria", "ls", "),", "[(", "sum", "(", "tot", "\\u", "reward", "[", "x", "-1", "00", ":", "x", "])", "/", "100", ")", " ", "if", " ", "x", " ", ">=", "100", " ", "else", " ", "(", "sum", "(", "tot", "\\u", "reward", "[", "0", ":", "x", "])", "/", "x", ")", " ", "for", " ", "x", " ", "in", " ", "xran", "ge", "(", "num", "\\u", "tria", "ls", ")]", ",'", "r", "--", "',", "xran", "ge", "(", "num", "\\u", "tria", "ls", "),", "[(", "sum", "(", "tot", "\\u", "step", "s", "[", "x", "-1", "00", ":", "x", "])", "/", "100", ")", " ", "if", " ", "x", " ", ">=", "100", " ", "else", " ", "(", "sum", "(", "tot", "\\u", "step", "s", "[", "0", ":", "x", "])", "/", "x", ")", " ", "for", " ", "x", " ", "in", " ", "xran", "ge", "(", "num", "\\u", "tria", "ls", ")]", ",'", "b", "--", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "pyplot_", "._", "plot_", "(_", "[_", "(_", "sum_", "(_", "tot", "\\u", "reward_", "[_", "x_", "-_", "100_", ":_", "x_", "]_", ")_", "/_", "100_", ")_", "if_", "x_", ">=_", "100_", "else_", "(_", "sum_", "(_", "tot", "\\u", "reward_", "[_", "0_", ":_", "x_", "]_", ")_", "/_", "x_", ")_", "for_", "x_", "in_", "xrange_", "(_", "num", "\\u", "trials_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig", "1_", "._", "suptitle_", "(_", "\"", "Reward", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig", "2_", "=_", "pyplot_", "._", "figure_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyplot_", "._", "plot_", "(_", "[_", "(_", "sum_", "(_", "tot", "\\u", "steps_", "[_", "x_", "-_", "100_", ":_", "x_", "]_", ")_", "/_", "100_", ")_", "if_", "x_", ">=_", "100_", "else_", "(_", "sum_", "(_", "tot", "\\u", "steps_", "[_", "0_", ":_", "x_", "]_", ")_", "/_", "x_", ")_", "for_", "x_", "in_", "xrange_", "(_", "num", "\\u", "trials_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig", "2_", "._", "suptitle_", "(_", "\"", "Step", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyplot_", "._", "show_", "(_", ")_", "\\u\\u\\uN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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
ask/carrot/tests/backend.py
[ { "content": " def test_iterqueue(self):\n consumer = self.create_consumer()\n publisher = self.create_publisher()\n num = consumer.discard_all()\n\n it = consumer.iterqueue(limit=100)\n consumer.register_callback(lambda *args: args)\n\n for i in xrange(100):\n publisher.send({\"foo%d\" % i: \"bar%d\" % i})\n time.sleep(0.5)\n\n for i in xrange(100):\n try:\n message = it.next()\n data = message.decode()\n self.assertTrue(\"foo%d\" % i in data, \"foo%d not in data\" % i)\n self.assertEquals(data.get(\"foo%d\" % i), \"bar%d\" % i)\n except StopIteration:\n self.assertTrue(False, \"iterqueue fails StopIteration\")\n\n self.assertRaises(StopIteration, it.next)\n\n # no messages on queue raises StopIteration if infinite=False\n it = consumer.iterqueue()\n self.assertRaises(StopIteration, it.next)\n\n it = consumer.iterqueue(infinite=True)\n self.assertTrue(it.next() is None,\n \"returns None if no messages and inifite=True\")\n\n consumer.close()\n publisher.close()", "metadata": "root.BackendMessagingCase.test_iterqueue", "header": "['class', 'BackendMessagingCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 252 }, { "content": " def test_publisher_message_priority(self):\n consumer = self.create_consumer()\n publisher = self.create_publisher()\n consumer.discard_all()\n\n m = publisher.create_message(\"foo\", priority=9)\n\n publisher.send({\"foo\": \"bar\"}, routing_key=\"nowhere\", priority=9,\n mandatory=False, immediate=False)\n\n consumer.discard_all()\n\n consumer.close()\n publisher.close()", "metadata": "root.BackendMessagingCase.test_publisher_message_priority", "header": "['class', 'BackendMessagingCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 286 }, { "content": " def disabled_publisher_mandatory_flag_regr16(self):\n \"\"\"\n Test that the publisher \"mandatory\" flag\n raises exceptions at appropriate times.\n \"\"\"\n routing_key = 'black_hole'\n\n assert self.conn.connection is not None\n\n message = {'foo': 'mandatory'}\n\n # sanity check cleanup from last test\n assert not self.create_consumer().backend.queue_exists(routing_key)\n\n publisher = self.create_publisher()\n\n # this should just get discarded silently, it's not mandatory\n publisher.send(message, routing_key=routing_key, mandatory=False)\n\n # This raises an unspecified exception because there is no queue to\n # deliver to\n self.assertRaises(Exception, publisher.send, message,\n routing_key=routing_key, mandatory=True)\n\n # now bind a queue to it\n consumer = Consumer(connection=self.conn,\n queue=routing_key, exchange=self.exchange,\n routing_key=routing_key, durable=False,\n exclusive=True)\n\n # check that it exists\n assert self.create_consumer().backend.queue_exists(routing_key)\n\n # this should now get routed to our consumer with no exception\n publisher.send(message, routing_key=routing_key, mandatory=True)", "metadata": "root.BackendMessagingCase.disabled_publisher_mandatory_flag_regr16", "header": "['class', 'BackendMessagingCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 312 } ]
[ { "span": "num ", "start_line": 255, "start_column": 8, "end_line": 255, "end_column": 11 }, { "span": "m ", "start_line": 291, "start_column": 8, "end_line": 291, "end_column": 9 }, { "span": "consumer ", "start_line": 337, "start_column": 8, "end_line": 337, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Back", "end", "Messag", "ing", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "iter", "queue_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "consumer_", "=_", "self_", "._", "create", "\\u", "consumer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "publisher_", "=_", "self_", "._", "create", "\\u", "publisher_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num_", "=_", "consumer_", "._", "discard", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "it_", "=_", "consumer_", "._", "iter", "queue_", "(_", "limit_", "=_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "consumer_", "._", "register", "\\u", "callback_", "(_", "lambda_", "*_", "args_", ":_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "publisher_", "._", "send_", "(_", "{_", "\"", "foo", "%", "d", "\"_", "%_", "i_", ":_", "\"", "bar", "%", "d", "\"_", "%_", "i_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "it_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "message_", "._", "decode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "foo", "%", "d", "\"_", "%_", "i_", "in_", "data_", ",_", "\"", "foo", "%", "d", " ", "not", " ", "in", " ", "data", "\"_", "%_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "data_", "._", "get_", "(_", "\"", "foo", "%", "d", "\"_", "%_", "i_", ")_", ",_", "\"", "bar", "%", "d", "\"_", "%_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sto", "p", "Iteration_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "False_", ",_", "\"", "iter", "queue", " ", "fail", "s", " ", "Sto", "p", "Iterat", "ion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Sto", "p", "Iteration_", ",_", "it_", "._", "next_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "no", " ", "message", "s", " ", "on", " ", "queue", " ", "raise", "s", " ", "Sto", "p", "Iterat", "ion", " ", "if", " ", "infini", "te", "=", "False_", "\\u\\u\\uNL\\u\\u\\u_", "it_", "=_", "consumer_", "._", "iter", "queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Sto", "p", "Iteration_", ",_", "it_", "._", "next_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "it_", "=_", "consumer_", "._", "iter", "queue_", "(_", "infini", "te_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "it_", "._", "next_", "(_", ")_", "is_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "return", "s", " ", "Non", "e", " ", "if", " ", "no", " ", "message", "s", " ", "and", " ", "ini", "fit", "e", "=", "Tru", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "consumer_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "publisher_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Back", "end", "Messag", "ing", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "publi", "sher", "\\u", "message", "\\u", "priority_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "consumer_", "=_", "self_", "._", "create", "\\u", "consumer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "publisher_", "=_", "self_", "._", "create", "\\u", "publisher_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "consumer_", "._", "discard", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "=_", "publisher_", "._", "create", "\\u", "message_", "(_", "\"", "foo", "\"_", ",_", "priority_", "=_", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "publisher_", "._", "send_", "(_", "{_", "\"", "foo", "\"_", ":_", "\"", "bar", "\"_", "}_", ",_", "routin", "g", "\\u", "key_", "=_", "\"", "now", "here", "\"_", ",_", "priority_", "=_", "9_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mandatory_", "=_", "False_", ",_", "immediate", "_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "consumer_", "._", "discard", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "consumer_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "publisher_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Back", "end", "Messag", "ing", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "disable", "d\\u", "publi", "sher", "\\u", "mandat", "ory", "\\u", "flag", "\\u", "regr", "16_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "tha", "t", " ", "the", " ", "publi", "sher", " ", "\"", "mandat", "ory", "\"", " ", "flag", "\\", "10", ";", " ", " ", " ", " ", "raise", "s", " ", "exception", "s", " ", "at", " ", "appropr", "iate", " ", "times", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "routin", "g", "\\u", "key_", "=_", "'", "black", "\\u", "hole", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "self_", "._", "conn_", "._", "connection_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "{_", "'", "foo", "'_", ":_", "'", "mandat", "ory", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sanity", " ", "check", " ", "clean", "up", " ", "from", " ", "last", " ", "test_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "not_", "self_", "._", "create", "\\u", "consumer_", "(_", ")_", "._", "backend_", "._", "queue", "\\u", "exists_", "(_", "routin", "g", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "publisher_", "=_", "self_", "._", "create", "\\u", "publisher_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "shou", "ld", " ", "just", " ", "get", " ", "discard", "ed", " ", "silently", ",", " ", "it", "'", "s", " ", "not", " ", "mandatory_", "\\u\\u\\uNL\\u\\u\\u_", "publisher_", "._", "send_", "(_", "message_", ",_", "routin", "g", "\\u", "key_", "=_", "routin", "g", "\\u", "key_", ",_", "mandatory_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "raise", "s", " ", "an", " ", "unspe", "cif", "ied", " ", "exception", " ", "bec", "aus", "e", " ", "there", " ", "is", " ", "no", " ", "queue", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "deliver", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Exception_", ",_", "publisher_", "._", "send_", ",_", "message_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "routin", "g", "\\u", "key_", "=_", "routin", "g", "\\u", "key_", ",_", "mandatory_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "bind", " ", "a", " ", "queue", " ", "to", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "consumer_", "=_", "Consumer_", "(_", "connection_", "=_", "self_", "._", "conn_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "queue_", "=_", "routin", "g", "\\u", "key_", ",_", "exchange_", "=_", "self_", "._", "exchange_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "routin", "g", "\\u", "key_", "=_", "routin", "g", "\\u", "key_", ",_", "durab", "le_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exclusive_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "tha", "t", " ", "it", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "self_", "._", "create", "\\u", "consumer_", "(_", ")_", "._", "backend_", "._", "queue", "\\u", "exists_", "(_", "routin", "g", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "shou", "ld", " ", "now", " ", "get", " ", "route", "d", " ", "to", " ", "our", " ", "consume", "r", " ", "with", " ", "no", " ", "exception_", "\\u\\u\\uNL\\u\\u\\u_", "publisher_", "._", "send_", "(_", "message_", ",_", "routin", "g", "\\u", "key_", "=_", "routin", "g", "\\u", "key_", ",_", "mandatory_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
XiaoMi/minos/owl/monitor/management/commands/count_rows.py
[ { "content": " def count_rows(self, cluster_name, table_name):\n logger.info(\"Count the rows of \" + table_name + \" in \" + cluster_name)\n\n try:\n # deploy shell hbase sdtst-miliao org.apache.hadoop.hbase.coprocessor.example.CoprocessorRowcounter _acl_ --speed=3000\n deploy_command = settings.DEPLOY_COMMAND\n command_list = [deploy_command, \"shell\", \"hbase\"] + [cluster_name] + [\"org.apache.hadoop.hbase.coprocessor.example.CoprocessorRowcounter\"] + [table_name] + [\"--speed=3000\"]\n\n rowcounter_process = subprocess.Popen(command_list, stdout=subprocess.PIPE)\n rowcounter_result = rowcounter_process.communicate()\n rowcounter_status = rowcounter_process.wait()\n\n # e.g. \"_acl_ 2014-4-18 3\"\n pattern = table_name + \" \\\\d+\\\\-\\\\d+\\\\-\\\\d+ (\\\\d+)\"; \n compiled_pattern = re.compile(pattern)\n re_result = compiled_pattern.search(rowcounter_result[0])\n return re_result.group(1)\n except:\n logger.error(\"Error to count rows, make sure kinit to run CoprocessorRowcounter and set DEPLOY_COMMAND\")\n return -1", "metadata": "root.Command.count_rows", "header": "['class', 'Command', '(', 'BaseCommand', ')', ':', '___EOS___']", "index": 72 } ]
[ { "span": "rowcounter_status ", "start_line": 82, "start_column": 6, "end_line": 82, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "count", "\\u", "rows_", "(_", "self_", ",_", "cluster", "\\u", "name_", ",_", "table", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\"", "Count", " ", "the", " ", "rows", " ", "of", " ", "\"_", "+_", "table", "\\u", "name_", "+_", "\"", " ", "in", " ", "\"_", "+_", "cluster", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "deploy", " ", "shell", " ", "hbase", " ", "sd", "tst", "-", "mili", "ao", " ", "org", ".", "apa", "che", ".", "hadoop", ".", "hbase", ".", "cop", "rocess", "or", ".", "example", ".", "Cop", "rocess", "or", "Row", "counter", " ", "\\u", "acl", "\\u", " ", "--", "speed", "=", "3000_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deploy", "\\u", "command_", "=_", "settings_", "._", "DEPLOY", "\\u", "COMMAND_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "command", "\\u", "list_", "=_", "[_", "deploy", "\\u", "command_", ",_", "\"", "shell", "\"_", ",_", "\"", "hbase", "\"_", "]_", "+_", "[_", "cluster", "\\u", "name_", "]_", "+_", "[_", "\"", "org", ".", "apa", "che", ".", "hadoop", ".", "hbase", ".", "cop", "rocess", "or", ".", "example", ".", "Cop", "rocess", "or", "Row", "counter", "\"_", "]_", "+_", "[_", "table", "\\u", "name_", "]_", "+_", "[_", "\"--", "speed", "=", "3000", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rowco", "unter", "\\u", "process_", "=_", "subprocess_", "._", "Popen_", "(_", "command", "\\u", "list_", ",_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rowco", "unter", "\\u", "result_", "=_", "rowco", "unter", "\\u", "process_", "._", "communicate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rowco", "unter", "\\u", "status_", "=_", "rowco", "unter", "\\u", "process_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "e", ".", "g", ".", " ", "\"\\u", "acl", "\\u", " ", "2014", "-", "4", "-1", "8", " ", "3", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "pattern_", "=_", "table", "\\u", "name_", "+_", "\"", " ", "\\\\\\\\", "d", "+\\\\", "\\\\-\\", "\\\\", "\\", "d", "+\\\\", "\\\\-\\", "\\\\", "\\", "d", "+", " ", "(\\\\\\\\", "d", "+)\"_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compile", "d\\u", "pattern_", "=_", "re_", "._", "compile_", "(_", "pattern_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "re", "\\u", "result_", "=_", "compile", "d\\u", "pattern_", "._", "search_", "(_", "rowco", "unter", "\\u", "result_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "re", "\\u", "result_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "\"", "Error", " ", "to", " ", "count", " ", "rows", ",", " ", "make", " ", "sure", " ", "kin", "it", " ", "to", " ", "run", " ", "Cop", "rocess", "or", "Row", "counter", " ", "and", " ", "set", " ", "DEPLOY", "\\u", "COMMA", "ND", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "-_", "1_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
thinkst/opencanary/opencanary/modules/ssh.py
[ { "content": " def auth_publickey(self, packet):\n\n try:\n #extract the public key blob from the SSH packet\n key_blob = getNS(getNS(packet[1:])[1])[0]\n except:\n key_blob = \"No public key found.\"\n\n try:\n #convert blob into openssh key format\n key = keys.Key.fromString(key_blob).toString('openssh')\n except:\n key = \"Invalid SSH Public Key Submitted: {key_blob}\".format(key_blob=key_blob.encode('hex'))\n for keytype in ['ecdsa-sha2-nistp256','ecdsa-sha2-nistp384','ecdsa-sha2-nistp521','ssh-ed25519']:\n if keytype in key_blob:\n key = '{keytype} {keydata}'.format(\n keytype=keytype,\n keydata=base64.b64encode(key_blob))\n\n print 'Key was {key}'.format(key=key)\n\n c = credentials.SSHPrivateKey(None,None,None,None,None)\n\n #self.log(key=key)\n\n return self.portal.login(c, None, conchinterfaces.IConchUser).addErrback(\n self._ebPassword)", "metadata": "root.HoneyPotSSHUserAuthServer.auth_publickey", "header": "['class', 'HoneyPotSSHUserAuthServer', '(', 'userauth', '.', 'SSHUserAuthServer', ')', ':', '___EOS___']", "index": 74 }, { "content": " def lastlogExit(self):\n starttime = time.strftime('%a %b %d %H:%M',\n time.localtime(self.logintime))\n endtime = time.strftime('%H:%M',\n time.localtime(time.time()))\n duration = str((time.time() - self.logintime))\n clientIP = self.transport.getPeer().host\n #print('root\\tpts/0\\t%s\\t%s - %s (%s)' % \\\n # (clientIP, starttime, endtime, duration))", "metadata": "root.HoneyPotTransport.lastlogExit", "header": "['class', 'HoneyPotTransport', '(', 'transport', '.', 'SSHServerTransport', ')', ':', '___EOS___']", "index": 194 } ]
[ { "span": "key ", "start_line": 84, "start_column": 12, "end_line": 84, "end_column": 15 }, { "span": "starttime ", "start_line": 195, "start_column": 8, "end_line": 195, "end_column": 17 }, { "span": "endtime ", "start_line": 197, "start_column": 8, "end_line": 197, "end_column": 15 }, { "span": "duration ", "start_line": 199, "start_column": 8, "end_line": 199, "end_column": 16 }, { "span": "clientIP ", "start_line": 200, "start_column": 8, "end_line": 200, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Hon", "ey", "Pot", "SSH", "User", "Auth", "Server_", "(_", "usera", "uth_", "._", "SSH", "User", "Auth", "Server_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "auth", "\\u", "public", "key_", "(_", "self_", ",_", "packet_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "extract", " ", "the", " ", "public", " ", "key", " ", "blob", " ", "from", " ", "the", " ", "SSH", " ", "packet_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key", "\\u", "blob_", "=_", "get", "NS_", "(_", "get", "NS_", "(_", "packet_", "[_", "1_", ":_", "]_", ")_", "[_", "1_", "]_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key", "\\u", "blob_", "=_", "\"", "No", " ", "public", " ", "key", " ", "found", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "convert", " ", "blob", " ", "int", "o", " ", "openss", "h", " ", "key", " ", "format_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "keys_", "._", "Key_", "._", "from", "String_", "(_", "key", "\\u", "blob_", ")_", "._", "to", "String_", "(_", "'", "openss", "h", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "\"", "Inva", "lid", " ", "SSH", " ", "Public", " ", "Key", " ", "Submitte", "d", ":", " ", "{", "key", "\\u", "blob", "}\"_", "._", "format_", "(_", "key", "\\u", "blob_", "=_", "key", "\\u", "blob_", "._", "encode_", "(_", "'", "hex", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "keyt", "ype_", "in_", "[_", "'", "ecd", "sa", "-", "sha2", "-", "nist", "p2", "56", "'_", ",_", "'", "ecd", "sa", "-", "sha2", "-", "nist", "p3", "84", "'_", ",_", "'", "ecd", "sa", "-", "sha2", "-", "nist", "p5", "21", "'_", ",_", "'", "ssh", "-", "ed", "2551", "9", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "keyt", "ype_", "in_", "key", "\\u", "blob_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "key_", "=_", "'{", "keyt", "ype", "}", " ", "{", "keyd", "ata", "}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "keyt", "ype_", "=_", "keyt", "ype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keyd", "ata_", "=_", "base64_", "._", "b64encode_", "(_", "key", "\\u", "blob_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'", "Key", " ", "was", " ", "{", "key", "}'_", "._", "format_", "(_", "key_", "=_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c_", "=_", "credentials_", "._", "SSH", "Priva", "te", "Key_", "(_", "None_", ",_", "None_", ",_", "None_", ",_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "log", "(", "key", "=", "key", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "portal_", "._", "login_", "(_", "c_", ",_", "None_", ",_", "conc", "hin", "ter", "faces_", "._", "IC", "onc", "h", "User_", ")_", "._", "add", "Errback_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "eb", "Password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hon", "ey", "Pot", "Transport_", "(_", "transport_", "._", "SSH", "Server", "Transport_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "last", "log", "Exit_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "starttime_", "=_", "time_", "._", "strftime_", "(_", "'%", "a", " ", "%", "b", " ", "%", "d", " ", "%", "H", ":", "%", "M", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "localtime_", "(_", "self_", "._", "login", "time_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "endtime_", "=_", "time_", "._", "strftime_", "(_", "'%", "H", ":", "%", "M", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "localtime_", "(_", "time_", "._", "time_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "duration_", "=_", "str_", "(_", "(_", "time_", "._", "time_", "(_", ")_", "-_", "self_", "._", "login", "time_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "IP_", "=_", "self_", "._", "transport_", "._", "get", "Peer", "_", "(_", ")_", "._", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", "('", "root", "\\\\", "tp", "ts", "/", "0", "\\\\", "t", "%", "s", "\\\\", "t", "%", "s", " ", "-", " ", "%", "s", " ", "(%", "s", ")'", " ", "%", " ", "\\\\_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "(", "client", "IP", ",", " ", "startt", "ime", ",", " ", "endtime", ",", " ", "duration", "))", "_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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gewall/trac/contrib/checkwiki.py
[ { "content": " def __iter__(self):\n return LinesIterator(self.formatter, self.text.splitlines())", "metadata": "root.SourceWrapper.__iter__", "header": "['class', 'SourceWrapper', '(', 'object', ')', ':', '___EOS___']", "index": 86 }, { "content": "class LinesIterator(object):\n\n", "metadata": "root.LinesIterator", "header": "['module', '___EOS___']", "index": 90 } ]
[ { "span": "class LinesIterator(object):", "start_line": 90, "start_column": 0, "end_line": 90, "end_column": 28 } ]
[ { "span": "def __iter__(self):", "start_line": 86, "start_column": 4, "end_line": 86, "end_column": 23 } ]
1
false
[ "[CLS]_", "`_", "\\u\\u", "iter\\u\\u_", "`_", "method_", "returns_", "a_", "non", "_", "-_", "iterator_", "[SEP]_", "class_", "Sou", "rce", "Wrapper_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Line", "s", "Iterator_", "(_", "self_", "._", "formatter_", ",_", "self_", "._", "text_", "._", "splitlines_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Line", "s", "Iterator_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2 ]
Special method has incorrect signature
kurrik/chrome-extensions/crx-appengine-packager/pyasn1/type/tag.py
[ { "content": " def __and__(self, (tagClass, tagFormat, tagId)):\n return self.__class__(\n self.__tag&tagClass, self.__tag&tagFormat, self.__tag&tagId\n )", "metadata": "root.Tag.__and__", "header": "['class', 'Tag', ':', '___EOS___']", "index": 42 }, { "content": " def __or__(self, (tagClass, tagFormat, tagId)):\n return self.__class__(\n self.__tag[0]|tagClass, self.__tag[1]|tagFormat, self.__tag[2]|tagId\n )", "metadata": "root.Tag.__or__", "header": "['class', 'Tag', ':', '___EOS___']", "index": 46 } ]
[ { "span": "def __and__(self, (tagClass, tagFormat, tagId)):", "start_line": 42, "start_column": 4, "end_line": 42, "end_column": 52 }, { "span": "def __or__(self, (tagClass, tagFormat, tagId)):", "start_line": 46, "start_column": 4, "end_line": 46, "end_column": 51 } ]
[]
1
true
[ "[CLS]_", "Special", "_", "method_", "has_", "incorrect", "_", "signature_", "[SEP]_", "class_", "Tag_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "and", "\\u\\u_", "(_", "self_", ",_", "(_", "tag", "Class_", ",_", "tag", "Format_", ",_", "tag", "Id_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "class\\u\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "tag_", "&_", "tag", "Class_", ",_", "self_", "._", "\\u\\u", "tag_", "&_", "tag", "Format_", ",_", "self_", "._", "\\u\\u", "tag_", "&_", "tag", "Id_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tag_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "or\\u\\u", "_", "(_", "self_", ",_", "(_", "tag", "Class_", ",_", "tag", "Format_", ",_", "tag", "Id_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "class\\u\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "tag_", "[_", "0_", "]_", "|_", "tag", "Class_", ",_", "self_", "._", "\\u\\u", "tag_", "[_", "1_", "]_", "|_", "tag", "Format_", ",_", "self_", "._", "\\u\\u", "tag_", "[_", "2_", "]_", "|_", "tag", "Id_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
AppScale/appscale/AppServer/lib/django-1.5/tests/regressiontests/urlpatterns_reverse/tests.py
[ { "content": " def test_404_tried_urls_have_names(self):\n \"\"\"\n Verifies that the list of URLs that come back from a Resolver404\n exception contains a list in the right format for printing out in\n the DEBUG 404 page with both the patterns and URL names, if available.\n \"\"\"\n urls = 'regressiontests.urlpatterns_reverse.named_urls'\n # this list matches the expected URL types and names returned when\n # you try to resolve a non-existent URL in the first level of included\n # URLs in named_urls.py (e.g., '/included/non-existent-url')\n url_types_names = [\n [{'type': RegexURLPattern, 'name': 'named-url1'}],\n [{'type': RegexURLPattern, 'name': 'named-url2'}],\n [{'type': RegexURLPattern, 'name': None}],\n [{'type': RegexURLResolver}, {'type': RegexURLPattern, 'name': 'named-url3'}],\n [{'type': RegexURLResolver}, {'type': RegexURLPattern, 'name': 'named-url4'}],\n [{'type': RegexURLResolver}, {'type': RegexURLPattern, 'name': None}],\n [{'type': RegexURLResolver}, {'type': RegexURLResolver}],\n ]\n try:\n resolve('/included/non-existent-url', urlconf=urls)\n self.fail('resolve did not raise a 404')\n except Resolver404 as e:\n # make sure we at least matched the root ('/') url resolver:\n self.assertTrue('tried' in e.args[0])\n tried = e.args[0]['tried']\n self.assertEqual(len(e.args[0]['tried']), len(url_types_names), 'Wrong number of tried URLs returned. Expected %s, got %s.' % (len(url_types_names), len(e.args[0]['tried'])))\n for tried, expected in zip(e.args[0]['tried'], url_types_names):\n for t, e in zip(tried, expected):\n self.assertTrue(isinstance(t, e['type']), str('%s is not an instance of %s') % (t, e['type']))\n if 'name' in e:\n if not e['name']:\n self.assertTrue(t.name is None, 'Expected no URL name but found %s.' % t.name)\n else:\n self.assertEqual(t.name, e['name'], 'Wrong URL name. Expected \"%s\", got \"%s\".' % (e['name'], t.name))", "metadata": "root.ResolverTests.test_404_tried_urls_have_names", "header": "['class', 'ResolverTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 210 }, { "content": " def test_user_permission_with_lazy_reverse(self):\n user = User.objects.create_user('alfred', '[email protected]', password='testpw')\n response = self.client.get('/login_required_view/')\n self.assertRedirects(response, \"/login/?next=/login_required_view/\", status_code=302)\n self.client.login(username='alfred', password='testpw')\n response = self.client.get('/login_required_view/')\n self.assertEqual(response.status_code, 200)", "metadata": "root.ReverseLazyTest.test_user_permission_with_lazy_reverse", "header": "['class', 'ReverseLazyTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 253 } ]
[ { "span": "tried ", "start_line": 235, "start_column": 12, "end_line": 235, "end_column": 17 }, { "span": "user ", "start_line": 254, "start_column": 8, "end_line": 254, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Resolv", "er", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "404", "\\u", "trie", "d\\u", "urls", "\\u", "have", "\\u", "names_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Verifie", "s", " ", "tha", "t", " ", "the", " ", "list", " ", "of", " ", "URL", "s", " ", "tha", "t", " ", "come", " ", "back", " ", "from", " ", "a", " ", "Resolv", "er", "404", "\\", "10", ";", " ", " ", " ", " ", "exception", " ", "contain", "s", " ", "a", " ", "list", " ", "in", " ", "the", " ", "right", " ", "format", " ", "for", " ", "printin", "g", " ", "out", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "DEBU", "G", " ", "404", " ", "page", " ", "with", " ", "bot", "h", " ", "the", " ", "pattern", "s", " ", "and", " ", "URL", " ", "names", ",", " ", "if", " ", "avail", "able", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "urls_", "=_", "'", "regress", "ion", "tests", ".", "urlpa", "tter", "ns", "\\u", "reverse", ".", "named", "\\u", "urls", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "list", " ", "matche", "s", " ", "the", " ", "expected", " ", "URL", " ", "types", " ", "and", " ", "names", " ", "return", "ed", " ", "when_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "try", " ", "to", " ", "resolve", " ", "a", " ", "non", "-", "existen", "t", " ", "URL", " ", "in", " ", "the", " ", "first", " ", "level", " ", "of", " ", "included_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "URL", "s", " ", "in", " ", "named", "\\u", "urls", ".", "py", " ", "(", "e", ".", "g", ".,", " ", "'/", "include", "d", "/", "non", "-", "existen", "t", "-", "url", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "url", "\\u", "types", "\\u", "names_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "{_", "'", "type", "'_", ":_", "Rege", "x", "URL", "Pattern_", ",_", "'", "name", "'_", ":_", "'", "named", "-", "url", "1", "'_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "{_", "'", "type", "'_", ":_", "Rege", "x", "URL", "Pattern_", ",_", "'", "name", "'_", ":_", "'", "named", "-", "url2", "'_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "{_", "'", "type", "'_", ":_", "Rege", "x", "URL", "Pattern_", ",_", "'", "name", "'_", ":_", "None_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "{_", "'", "type", "'_", ":_", "Rege", "x", "URL", "Resolver_", "}_", ",_", "{_", "'", "type", "'_", ":_", "Rege", "x", "URL", "Pattern_", ",_", "'", "name", "'_", ":_", "'", "named", "-", "url", "3", "'_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "{_", "'", "type", "'_", ":_", "Rege", "x", "URL", "Resolver_", "}_", ",_", "{_", "'", "type", "'_", ":_", "Rege", "x", "URL", "Pattern_", ",_", "'", "name", "'_", ":_", "'", "named", "-", "url", "4", "'_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "{_", "'", "type", "'_", ":_", "Rege", "x", "URL", "Resolver_", "}_", ",_", "{_", "'", "type", "'_", ":_", "Rege", "x", "URL", "Pattern_", ",_", "'", "name", "'_", ":_", "None_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "{_", "'", "type", "'_", ":_", "Rege", "x", "URL", "Resolver_", "}_", ",_", "{_", "'", "type", "'_", ":_", "Rege", "x", "URL", "Resolver_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resolve_", "(_", "'/", "include", "d", "/", "non", "-", "existen", "t", "-", "url", "'_", ",_", "url", "conf_", "=_", "urls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", "'", "resolve", " ", "did", " ", "not", " ", "raise", " ", "a", " ", "404", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Resolv", "er", "404_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "we", " ", "at", " ", "leas", "t", " ", "matche", "d", " ", "the", " ", "root", " ", "('", "/'", ")", " ", "url", " ", "resolver", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "'", "trie", "d", "'_", "in_", "e_", "._", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trie", "d_", "=_", "e_", "._", "args_", "[_", "0_", "]_", "[_", "'", "trie", "d", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "e_", "._", "args_", "[_", "0_", "]_", "[_", "'", "trie", "d", "'_", "]_", ")_", ",_", "len_", "(_", "url", "\\u", "types", "\\u", "names_", ")_", ",_", "'", "Wro", "ng", " ", "number", " ", "of", " ", "trie", "d", " ", "URL", "s", " ", "return", "ed", ".", " ", " ", "Expect", "ed", " ", "%", "s", ",", " ", "got", " ", "%", "s", ".'_", "%_", "(_", "len_", "(_", "url", "\\u", "types", "\\u", "names_", ")_", ",_", "len_", "(_", "e_", "._", "args_", "[_", "0_", "]_", "[_", "'", "trie", "d", "'_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "trie", "d_", ",_", "expected_", "in_", "zip_", "(_", "e_", "._", "args_", "[_", "0_", "]_", "[_", "'", "trie", "d", "'_", "]_", ",_", "url", "\\u", "types", "\\u", "names_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "t_", ",_", "e_", "in_", "zip_", "(_", "trie", "d_", ",_", "expected_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "t_", ",_", "e_", "[_", "'", "type", "'_", "]_", ")_", ",_", "str_", "(_", "'%", "s", " ", "is", " ", "not", " ", "an", " ", "instance", " ", "of", " ", "%", "s", "'_", ")_", "%_", "(_", "t_", ",_", "e_", "[_", "'", "type", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "name", "'_", "in_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "not_", "e_", "[_", "'", "name", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "assert", "True_", "(_", "t_", "._", "name_", "is_", "None_", ",_", "'", "Expect", "ed", " ", "no", " ", "URL", " ", "name", " ", "but", " ", "found", " ", "%", "s", ".'_", "%_", "t_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "assert", "Equal_", "(_", "t_", "._", "name_", ",_", "e_", "[_", "'", "name", "'_", "]_", ",_", "'", "Wro", "ng", " ", "URL", " ", "name", ".", " ", " ", "Expect", "ed", " ", "\"%", "s", "\",", " ", "got", " ", "\"%", "s", "\".'_", "%_", "(_", "e_", "[_", "'", "name", "'_", "]_", ",_", "t_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Revers", "e", "La", "zy", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "user", "\\u", "permissi", "on", "\\u", "with", "\\u", "lazy", "\\u", "reverse_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "User_", "._", "objects_", "._", "create", "\\u", "user_", "(_", "'", "alf", "red", "'_", ",_", "'", "alf", "red", "@", "example", ".", "com", "'_", ",_", "password_", "=_", "'", "testp", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'/", "login", "\\u", "require", "d\\u", "view", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Redirects_", "(_", "response_", ",_", "\"/", "login", "/?", "next", "=", "/", "login", "\\u", "require", "d\\u", "view", "/\"_", ",_", "status", "\\u", "code_", "=_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "client_", "._", "login_", "(_", "username_", "=_", "'", "alf", "red", "'_", ",_", "password_", "=_", "'", "testp", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'/", "login", "\\u", "require", "d\\u", "view", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
rizar/attention-lvcsr/libs/Theano/theano/compile/tests/test_profiling.py
[ { "content": " def test_profiling(self):\n\n config1 = theano.config.profile\n config2 = theano.config.profile_memory\n config3 = theano.config.profiling.min_peak_memory\n try:\n theano.config.profile = True\n theano.config.profile_memory = True\n theano.config.profiling.min_peak_memory = True\n\n x = [T.fvector(\"val%i\" % i) for i in range(3)]\n\n z = []\n z += [T.outer(x[i], x[i + 1]).sum(axis=1) for i in range(len(x) - 1)]\n z += [x[i] + x[i + 1] for i in range(len(x) - 1)]\n\n p = theano.ProfileStats(False)\n\n if theano.config.mode in [\"DebugMode\", \"DEBUG_MODE\", \"FAST_COMPILE\"]:\n m = \"FAST_RUN\"\n else:\n m = None\n\n f = theano.function(x, z, profile=p, name=\"test_profiling\",\n mode=m)\n\n inp = [numpy.arange(1024, dtype='float32') + 1 for i in range(len(x))]\n output = f(*inp)\n\n buf = StringIO()\n f.profile.summary(buf)\n\n # regression testing for future algo speed up\n the_string = buf.getvalue()\n lines1 = [l for l in the_string.split(\"\\n\") if \"Max if linker\" in l]\n lines2 = [l for l in the_string.split(\"\\n\") if \"Minimum peak\" in l]\n if theano.config.device == 'cpu':\n assert \"CPU: 4112KB (8204KB)\" in the_string, (lines1, lines2)\n assert \"CPU: 8204KB (12296KB)\" in the_string, (lines1, lines2)\n assert \"CPU: 8208KB\" in the_string, (lines1, lines2)\n assert \"Minimum peak from all valid apply node order is 4104KB\" in the_string, (\n lines1, lines2)\n else:\n assert \"CPU: 16KB (16KB)\" in the_string, (lines1, lines2)\n assert \"GPU: 8204KB (8204KB)\" in the_string, (lines1, lines2)\n assert \"GPU: 12300KB (12300KB)\" in the_string, (lines1, lines2)\n assert \"GPU: 8212KB\" in the_string, (lines1, lines2)\n assert \"Minimum peak from all valid apply node order is 4116KB\" in the_string, (\n lines1, lines2)\n\n finally:\n theano.config.profile = config1\n theano.config.profile_memory = config2\n theano.config.profiling.min_peak_memory = config3", "metadata": "root.Test_profiling.test_profiling", "header": "['class', 'Test_profiling', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 19 }, { "content": " def test_ifelse(self):\n config1 = theano.config.profile\n config2 = theano.config.profile_memory\n\n try:\n theano.config.profile = True\n theano.config.profile_memory = True\n\n a, b = T.scalars('a', 'b')\n x, y = T.scalars('x', 'y')\n\n z = ifelse(T.lt(a, b), x * 2, y * 2)\n\n p = theano.ProfileStats(False)\n\n if theano.config.mode in [\"DebugMode\", \"DEBUG_MODE\", \"FAST_COMPILE\"]:\n m = \"FAST_RUN\"\n else:\n m = None\n\n f_ifelse = theano.function([a, b, x, y], z, profile=p, name=\"test_ifelse\",\n mode=m)\n\n val1 = 0.\n val2 = 1.\n big_mat1 = 10\n big_mat2 = 11\n\n out = f_ifelse(val1, val2, big_mat1, big_mat2)\n\n finally:\n theano.config.profile = config1\n theano.config.profile_memory = config2", "metadata": "root.Test_profiling.test_ifelse", "header": "['class', 'Test_profiling', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 75 } ]
[ { "span": "output ", "start_line": 46, "start_column": 12, "end_line": 46, "end_column": 18 }, { "span": "out ", "start_line": 103, "start_column": 12, "end_line": 103, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "\\u", "profiling", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "profiling", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config", "1_", "=_", "theano_", "._", "config_", "._", "profile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config", "2_", "=_", "theano_", "._", "config_", "._", "profile", "\\u", "memory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config", "3_", "=_", "theano_", "._", "config_", "._", "profiling", "_", "._", "min", "\\u", "peak", "\\u", "memory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "theano_", "._", "config_", "._", "profile_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "theano_", "._", "config_", "._", "profile", "\\u", "memory_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "theano_", "._", "config_", "._", "profiling", "_", "._", "min", "\\u", "peak", "\\u", "memory_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "[_", "T_", "._", "fv", "ector_", "(_", "\"", "val", "%", "i", "\"_", "%_", "i_", ")_", "for_", "i_", "in_", "range_", "(_", "3_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "z_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "+=_", "[_", "T_", "._", "outer_", "(_", "x_", "[_", "i_", "]_", ",_", "x_", "[_", "i_", "+_", "1_", "]_", ")_", "._", "sum_", "(_", "axis_", "=_", "1_", ")_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "x_", ")_", "-_", "1_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "+=_", "[_", "x_", "[_", "i_", "]_", "+_", "x_", "[_", "i_", "+_", "1_", "]_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "x_", ")_", "-_", "1_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "theano_", "._", "Profil", "e", "Stats_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "theano_", "._", "config_", "._", "mode_", "in_", "[_", "\"", "Deb", "ug", "Mode", "\"_", ",_", "\"", "DEBU", "G", "\\u", "MODE", "\"_", ",_", "\"", "FAST", "\\u", "COMPIL", "E", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "\"", "FAST", "\\u", "RUN", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "=_", "theano_", "._", "function_", "(_", "x_", ",_", "z_", ",_", "profile_", "=_", "p_", ",_", "name_", "=_", "\"", "test\\u", "profiling", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "inp_", "=_", "[_", "numpy_", "._", "arange_", "(_", "1024_", ",_", "dtype_", "=_", "'", "float", "32", "'_", ")_", "+_", "1_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "x_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "f_", "(_", "*_", "inp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "buf_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "profile_", "._", "summary_", "(_", "buf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "regress", "ion", " ", "testi", "ng", " ", "for", " ", "future", " ", "algo", " ", "speed", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "the", "\\u", "string_", "=_", "buf_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines", "1_", "=_", "[_", "l_", "for_", "l_", "in_", "the", "\\u", "string_", "._", "split_", "(_", "\"\\\\", "n", "\"_", ")_", "if_", "\"", "Max", " ", "if", " ", "linker", "\"_", "in_", "l_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines", "2_", "=_", "[_", "l_", "for_", "l_", "in_", "the", "\\u", "string_", "._", "split_", "(_", "\"\\\\", "n", "\"_", ")_", "if_", "\"", "Mini", "mum", " ", "peak", "\"_", "in_", "l_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "theano_", "._", "config_", "._", "device_", "==_", "'", "cpu", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "\"", "CPU", ":", " ", "4112", "KB", " ", "(", "820", "4", "KB", ")\"_", "in_", "the", "\\u", "string_", ",_", "(_", "lines", "1_", ",_", "lines", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "CPU", ":", " ", "820", "4", "KB", " ", "(", "122", "96", "KB", ")\"_", "in_", "the", "\\u", "string_", ",_", "(_", "lines", "1_", ",_", "lines", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "CPU", ":", " ", "820", "8", "KB", "\"_", "in_", "the", "\\u", "string_", ",_", "(_", "lines", "1_", ",_", "lines", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "Mini", "mum", " ", "peak", " ", "from", " ", "all", " ", "valid", " ", "appl", "y", " ", "node", " ", "order", " ", "is", " ", "410", "4", "KB", "\"_", "in_", "the", "\\u", "string_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "lines", "1_", ",_", "lines", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "\"", "CPU", ":", " ", "16", "KB", " ", "(", "16", "KB", ")\"_", "in_", "the", "\\u", "string_", ",_", "(_", "lines", "1_", ",_", "lines", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "GPU", ":", " ", "820", "4", "KB", " ", "(", "820", "4", "KB", ")\"_", "in_", "the", "\\u", "string_", ",_", "(_", "lines", "1_", ",_", "lines", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "GPU", ":", " ", "123", "00", "KB", " ", "(", "123", "00", "KB", ")\"_", "in_", "the", "\\u", "string_", ",_", "(_", "lines", "1_", ",_", "lines", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "GPU", ":", " ", "821", "2", "KB", "\"_", "in_", "the", "\\u", "string_", ",_", "(_", "lines", "1_", ",_", "lines", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "Mini", "mum", " ", "peak", " ", "from", " ", "all", " ", "valid", " ", "appl", "y", " ", "node", " ", "order", " ", "is", " ", "411", "6", "KB", "\"_", "in_", "the", "\\u", "string_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "lines", "1_", ",_", "lines", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "theano_", "._", "config_", "._", "profile_", "=_", "config", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "theano_", "._", "config_", "._", "profile", "\\u", "memory_", "=_", "config", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "theano_", "._", "config_", "._", "profiling", "_", "._", "min", "\\u", "peak", "\\u", "memory_", "=_", "config", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "profiling", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ife", "lse", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config", "1_", "=_", "theano_", "._", "config_", "._", "profile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config", "2_", "=_", "theano_", "._", "config_", "._", "profile", "\\u", "memory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "theano_", "._", "config_", "._", "profile_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "theano_", "._", "config_", "._", "profile", "\\u", "memory_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", ",_", "b_", "=_", "T_", "._", "scalars", "_", "(_", "'", "a", "'_", ",_", "'", "b", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "y_", "=_", "T_", "._", "scalars", "_", "(_", "'", "x", "'_", ",_", "'", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "z_", "=_", "ife", "lse", "_", "(_", "T_", "._", "lt_", "(_", "a_", ",_", "b_", ")_", ",_", "x_", "*_", "2_", ",_", "y_", "*_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "theano_", "._", "Profil", "e", "Stats_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "theano_", "._", "config_", "._", "mode_", "in_", "[_", "\"", "Deb", "ug", "Mode", "\"_", ",_", "\"", "DEBU", "G", "\\u", "MODE", "\"_", ",_", "\"", "FAST", "\\u", "COMPIL", "E", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "\"", "FAST", "\\u", "RUN", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f", "\\u", "ife", "lse", "_", "=_", "theano_", "._", "function_", "(_", "[_", "a_", ",_", "b_", ",_", "x_", ",_", "y_", "]_", ",_", "z_", ",_", "profile_", "=_", "p_", ",_", "name_", "=_", "\"", "test\\u", "ife", "lse", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "val1_", "=_", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val2_", "=_", "1._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "big", "\\u", "mat", "1_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "big", "\\u", "mat", "2_", "=_", "11_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "=_", "f", "\\u", "ife", "lse", "_", "(_", "val1_", ",_", "val2_", ",_", "big", "\\u", "mat", "1_", ",_", "big", "\\u", "mat", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "theano_", "._", "config_", "._", "profile_", "=_", "config", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "theano_", "._", "config_", "._", "profile", "\\u", "memory_", "=_", "config", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ionelmc/django-admin-utils/tests/test_app/tests.py
[ { "content": "from django.test.client import Client\nfrom django.test import TestCase\nfrom django.contrib.auth.models import User\nfrom django.conf import settings\nfrom django.core.urlresolvers import reverse\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class MockAdminTestCase(TestCase):\n\n\n\n\n\n\n\n", "metadata": "root.MockAdminTestCase", "header": "['module', '___EOS___']", "index": 6 }, { "content": " def setUp(self):\n self.user = User(\n username='test', email='[email protected]', is_active=True,\n is_staff=True, is_superuser=True,\n )\n self.user.set_password('test')\n self.user.save()\n self.client.login(username='test', password='test')", "metadata": "root.MockAdminTestCase.setUp", "header": "['class', 'MockAdminTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 7 }, { "content": " def test_admin_not_broken(self):\n response = self.client.get('/admin/')\n self.assertContains(response, '/admin/password_change/')\n self.assertNotContains(response, \"You don't have permission to edit anything\")", "metadata": "root.MockAdminTestCase.test_admin_not_broken", "header": "['class', 'MockAdminTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 16 }, { "content": " def test_admin_auth_not_broken(self):\n response = self.client.get('/admin/auth/')\n self.assertEqual(response.status_code, 200, response)", "metadata": "root.MockAdminTestCase.test_admin_auth_not_broken", "header": "['class', 'MockAdminTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 21 }, { "content": " def test_admin_auth_user_not_broken(self):\n url = reverse('admin:auth_user_changelist')\n self.assertEqual(url, '/admin/auth/user/')\n response = self.client.get(url)\n self.assertEqual(response.status_code, 200, response)", "metadata": "root.MockAdminTestCase.test_admin_auth_user_not_broken", "header": "['class', 'MockAdminTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 25 }, { "content": " def test_admin_1_root(self):\n url = reverse('admin:test_app_test1_changelist')\n self.assertEqual(url, '/admin/test_app/test1/')\n self.assertRedirects(self.client.get(url.rstrip('/')), url, 301)\n response = self.client.get(url)\n self.assertEqual(response.status_code, 200, response)\n self.assertEqual(response.content, b\"root\", response)", "metadata": "root.MockAdminTestCase.test_admin_1_root", "header": "['class', 'MockAdminTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 31 }, { "content": " def test_admin_1_level1(self):\n url = reverse('admin:level-1')\n self.assertEqual(url, '/admin/test_app/test1/level1/')\n self.assertRedirects(self.client.get(url.rstrip('/')), url, 301)\n response = self.client.get(url)\n self.assertEqual(response.status_code, 200, response)\n self.assertEqual(response.content, b\"level1\", response)", "metadata": "root.MockAdminTestCase.test_admin_1_level1", "header": "['class', 'MockAdminTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 39 }, { "content": " def test_admin_1_level1_level2(self):\n url = reverse('admin:level-2')\n self.assertEqual(url, '/admin/test_app/test1/level1/level2/')\n self.assertRedirects(self.client.get(url.rstrip('/')), url, 301)\n response = self.client.get(url)\n self.assertEqual(response.status_code, 200, response)\n self.assertEqual(response.content, b\"level2\", response)", "metadata": "root.MockAdminTestCase.test_admin_1_level1_level2", "header": "['class', 'MockAdminTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 47 }, { "content": " def test_admin_2_root(self):\n url = reverse('admin:test_app_test2_changelist')\n self.assertEqual(url, '/admin/test_app/test2/')\n self.assertRedirects(self.client.get(url.rstrip('/')), url, 301)\n response = self.client.get(url)\n self.assertEqual(response.status_code, 200, response)\n self.assertEqual(response.content, b\"root\", response)", "metadata": "root.MockAdminTestCase.test_admin_2_root", "header": "['class', 'MockAdminTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 55 }, { "content": " def test_runtime_error(self):\n from .admin import make_admin_class, patterns, url\n from admin_utils.mock import InvalidAdmin\n self.assertRaises(\n InvalidAdmin,\n make_admin_class, \"Test\", patterns(\"test_app.views\",\n url(r'^$', 'root', name='whatever'),\n ), \"test_app\"\n )", "metadata": "root.MockAdminTestCase.test_runtime_error", "header": "['class', 'MockAdminTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 63 } ]
[ { "span": "from django.test.client import Client", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 37 }, { "span": "from django.conf import settings", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 32 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "test_", "._", "client_", "import_", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "test_", "import_", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Moc", "k", "Admi", "n", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Admi", "n", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "user_", "=_", "User_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "'", "test", "'_", ",_", "email_", "=_", "'", "test", "@", "example", ".", "com", "'_", ",_", "is", "\\u", "active_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "staff_", "=_", "True_", ",_", "is", "\\u", "superuser_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "user_", "._", "set\\u", "password_", "(_", "'", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "user_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "client_", "._", "login_", "(_", "username_", "=_", "'", "test", "'_", ",_", "password_", "=_", "'", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Admi", "n", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "admin", "\\u", "not", "\\u", "broken", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'/", "admin", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "response_", ",_", "'/", "admin", "/", "password", "\\u", "change", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Contains_", "(_", "response_", ",_", "\"", "You", " ", "don", "'", "t", " ", "have", " ", "permissi", "on", " ", "to", " ", "edit", " ", "anyt", "hing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Admi", "n", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "admin", "\\u", "auth", "\\u", "not", "\\u", "broken", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'/", "admin", "/", "auth", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Admi", "n", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "admin", "\\u", "auth", "\\u", "user", "\\u", "not", "\\u", "broken", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "reverse_", "(_", "'", "admin", ":", "auth", "\\u", "user", "\\u", "changeli", "st", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "url_", ",_", "'/", "admin", "/", "auth", "/", "user", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Admi", "n", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "admin", "\\u", "1", "\\u", "root_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "reverse_", "(_", "'", "admin", ":", "test\\u", "app", "\\u", "test", "1", "\\u", "changeli", "st", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "url_", ",_", "'/", "admin", "/", "test\\u", "app", "/", "test", "1", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Redirects_", "(_", "self_", "._", "client_", "._", "get_", "(_", "url_", "._", "rstrip_", "(_", "'/'_", ")_", ")_", ",_", "url_", ",_", "301_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "content_", ",_", "b", "\"", "root", "\"_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Admi", "n", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "admin", "\\u", "1", "\\u", "level", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "reverse_", "(_", "'", "admin", ":", "level", "-1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "url_", ",_", "'/", "admin", "/", "test\\u", "app", "/", "test", "1", "/", "level", "1", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Redirects_", "(_", "self_", "._", "client_", "._", "get_", "(_", "url_", "._", "rstrip_", "(_", "'/'_", ")_", ")_", ",_", "url_", ",_", "301_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "content_", ",_", "b", "\"", "level", "1", "\"_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Admi", "n", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "admin", "\\u", "1", "\\u", "level", "1", "\\u", "level", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "reverse_", "(_", "'", "admin", ":", "level", "-", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "url_", ",_", "'/", "admin", "/", "test\\u", "app", "/", "test", "1", "/", "level", "1", "/", "level", "2", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Redirects_", "(_", "self_", "._", "client_", "._", "get_", "(_", "url_", "._", "rstrip_", "(_", "'/'_", ")_", ")_", ",_", "url_", ",_", "301_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "content_", ",_", "b", "\"", "level", "2", "\"_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Admi", "n", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "admin", "\\u", "2", "\\u", "root_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "reverse_", "(_", "'", "admin", ":", "test\\u", "app", "\\u", "test", "2", "\\u", "changeli", "st", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "url_", ",_", "'/", "admin", "/", "test\\u", "app", "/", "test", "2", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Redirects_", "(_", "self_", "._", "client_", "._", "get_", "(_", "url_", "._", "rstrip_", "(_", "'/'_", ")_", ")_", ",_", "url_", ",_", "301_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "content_", ",_", "b", "\"", "root", "\"_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Admi", "n", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "runt", "ime", "\\u", "error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "._", "admin_", "import_", "make", "\\u", "admin", "\\u", "class_", ",_", "patterns_", ",_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "admin", "\\u", "utils_", "._", "mock_", "import_", "Inva", "lid", "Admin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Inva", "lid", "Admin_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "make", "\\u", "admin", "\\u", "class_", ",_", "\"", "Test", "\"_", ",_", "patterns_", "(_", "\"", "test\\u", "app", ".", "views", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "$'_", ",_", "'", "root", "'_", ",_", "name_", "=_", "'", "what", "ever", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\"", "test\\u", "app", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
Gallopsled/pwntools-write-ups/wargames/overthewire-vortex/level4/libformatstr/pattern.py
[ { "content": "def make_pattern(buffer_size, start_index=1, max_index=500):\n format_size = buffer_size // 2\n pattern_size = buffer_size // 8 \n \n index = start_index\n payload = msfpattern(pattern_size * 4)\n while True:\n fmt = \"%\" + str(index) + \"$p\"\n if len(payload) + len(fmt) > buffer_size:\n break\n payload += fmt\n index += pattern_size - 1\n if index > max_index:\n break\n return payload.ljust(buffer_size, \"X\")", "metadata": "root.make_pattern", "header": "['module', '___EOS___']", "index": 24 } ]
[ { "span": "format_size ", "start_line": 25, "start_column": 4, "end_line": 25, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "pattern_", "(_", "buffer", "\\u", "size_", ",_", "start", "\\u", "index_", "=_", "1_", ",_", "max", "\\u", "index_", "=_", "500_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "format\\u", "size_", "=_", "buffer", "\\u", "size_", "//_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pattern", "\\u", "size_", "=_", "buffer", "\\u", "size_", "//_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "start", "\\u", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payload_", "=_", "ms", "fpa", "tter", "n_", "(_", "pattern", "\\u", "size_", "*_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fmt_", "=_", "\"%\"_", "+_", "str_", "(_", "index_", ")_", "+_", "\"$", "p", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "payload_", ")_", "+_", "len_", "(_", "fmt_", ")_", ">_", "buffer", "\\u", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "payload_", "+=_", "fmt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "+=_", "pattern", "\\u", "size_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "index_", ">_", "max", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "payload_", "._", "ljust_", "(_", "buffer", "\\u", "size_", ",_", "\"", "X", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
nelinnemann/Salome-Scripts/Darpa-SubOff/Darpa-SubOff.py
[ { "content": "def makeRingWingStrut():\n \n XHLE=13.589\n XHTE=13.83582\n YHLE=0.14726\n YHTE=0.10547\n \n XDLE=[13.63845,13.64487]\n YDLE=[0.36886,0.39755]\n XDTE=[13.88818,13.89023]\n YDTE=[0.34002,0.34932]\n \n \n XC=[0.,0.0,0.005,0.0125,0.025,0.05\\\n ,0.075,0.1,0.15,0.2,0.25,0.3\\\n ,0.4,0.5,0.6,0.7,0.8,0.9,1.]\n\n for k in xrange(0,2):\n R1=YHLE\n R2=YDLE[k]\n DELR=(R2-R1)/9.\n R=R2+DELR*2.\n curveListStart = curveCounter\n for l in xrange(1,14):\n X0=0.223221*R+13.556128\n listStart=vertCounter\n for i in xrange(1,len(XC)):\n XI = XC[i]\n x=(X0+0.243995*XI)\n y=(R-0.054465*XI)\n z=0.15*(0.29690*math.sqrt(XI)-0.126*XI-0.3516*XI**2\\\n + 0.28520*XI**3 - 0.10450*XI**4)\n createPoint(x,y,z)\n listEnd=vertCounter\n createCurve(listStart,listEnd)\n R=R-DELR\n curveListEnd = curveCounter\n createFilling(curveListStart,curveListEnd)\n createMirror(fi[\"Filling_{0}\".format(compoundCounter-1)])\n \n createShell([fi[\"Filling_{0}\".format(compoundCounter-1)],\\\n mi[\"Mirror_{0}\".format(mirrorCounter-1)]])\n \n createSupressHoles(sh[\"Shell_{0}\".format(shellCounter-1)])\n \n createMultiRotation(sp[\"SupressHoles_{0}\".format(supressHolesCounter-1)]\\\n ,showInStudy=True,name=\"Ringwing_Strut_\"+str(k+1))\n \n geompy.Rotate(mr[\"Multi_Rotation_{0}\".format(multiRotationCounter-1)], OX, 45*math.pi/180.0)", "metadata": "root.makeRingWingStrut", "header": "['module', '___EOS___']", "index": 524 } ]
[ { "span": "XHLE=", "start_line": 526, "start_column": 4, "end_line": 526, "end_column": 8 }, { "span": "XHTE=", "start_line": 527, "start_column": 4, "end_line": 527, "end_column": 8 }, { "span": "YHTE=", "start_line": 529, "start_column": 4, "end_line": 529, "end_column": 8 }, { "span": "XDLE=", "start_line": 531, "start_column": 4, "end_line": 531, "end_column": 8 }, { "span": "XDTE=", "start_line": 533, "start_column": 4, "end_line": 533, "end_column": 8 }, { "span": "YDTE=", "start_line": 534, "start_column": 4, "end_line": 534, "end_column": 8 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "Ring", "Win", "g", "Stru", "t_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "XH", "LE_", "=_", "13.", "589", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "XH", "TE_", "=_", "13.", "835", "82_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "YH", "LE_", "=_", "0.14", "726", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "YH", "TE_", "=_", "0.10", "547", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "XD", "LE_", "=_", "[_", "13.", "638", "45_", ",_", "13.", "644", "87_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "YD", "LE_", "=_", "[_", "0.36", "886", "_", ",_", "0.39", "755", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "XD", "TE_", "=_", "[_", "13.", "888", "18_", ",_", "13.", "890", "23_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "YD", "TE_", "=_", "[_", "0.34", "002_", ",_", "0.34", "932", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "XC", "_", "=_", "[_", "0._", ",_", "0.0_", ",_", "0.005_", ",_", "0.012", "5_", ",_", "0.025", "_", ",_", "0.05_", ",_", "0.07", "5_", ",_", "0.1_", ",_", "0.15_", ",_", "0.2_", ",_", "0.25_", ",_", "0.3_", ",_", "0.4_", ",_", "0.5_", ",_", "0.6_", ",_", "0.7_", ",_", "0.8_", ",_", "0.9_", ",_", "1._", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "k_", "in_", "xrange_", "(_", "0_", ",_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R1_", "=_", "YH", "LE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "R2_", "=_", "YD", "LE_", "[_", "k_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEL", "R_", "=_", "(_", "R2_", "-_", "R1_", ")_", "/_", "9._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "R_", "=_", "R2_", "+_", "DEL", "R_", "*_", "2._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curve", "List", "Start_", "=_", "curve", "Counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "l_", "in_", "xrange_", "(_", "1_", ",_", "14_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "X0_", "=_", "0.22", "322", "1_", "*_", "R_", "+_", "13.", "556", "128_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "Start_", "=_", "vert", "Counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "1_", ",_", "len_", "(_", "XC", "_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "XI", "_", "=_", "XC", "_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "(_", "X0_", "+_", "0.24", "399", "5_", "*_", "XI", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "(_", "R_", "-_", "0.05", "446", "5_", "*_", "XI", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "=_", "0.15_", "*_", "(_", "0.29", "690", "_", "*_", "math_", "._", "sqrt_", "(_", "XI", "_", ")_", "-_", "0.12", "6_", "*_", "XI", "_", "-_", "0.35", "16_", "*_", "XI", "_", "**_", "2_", "+_", "0.28", "520", "_", "*_", "XI", "_", "**_", "3_", "-_", "0.10", "450_", "*_", "XI", "_", "**_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "Point_", "(_", "x_", ",_", "y_", ",_", "z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "list", "End_", "=_", "vert", "Counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "Curve_", "(_", "list", "Start_", ",_", "list", "End_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "R_", "=_", "R_", "-_", "DEL", "R_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "curve", "List", "End_", "=_", "curve", "Counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "Fil", "ling_", "(_", "curve", "List", "Start_", ",_", "curve", "List", "End_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "Mirror", "_", "(_", "fi_", "[_", "\"", "Fil", "ling", "\\u{", "0", "}\"_", "._", "format_", "(_", "compo", "und", "Counter_", "-_", "1_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "Shell_", "(_", "[_", "fi_", "[_", "\"", "Fil", "ling", "\\u{", "0", "}\"_", "._", "format_", "(_", "compo", "und", "Counter_", "-_", "1_", ")_", "]_", ",_", "mi_", "[_", "\"", "Mirror", "\\u{", "0", "}\"_", "._", "format_", "(_", "mirror", "Counter_", "-_", "1_", ")_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "Sup", "ress", "Hole", "s_", "(_", "sh_", "[_", "\"", "Shel", "l\\u", "{", "0", "}\"_", "._", "format_", "(_", "shell", "Counter_", "-_", "1_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "Multi", "Rotation_", "(_", "sp_", "[_", "\"", "Sup", "ress", "Hole", "s", "\\u{", "0", "}\"_", "._", "format_", "(_", "sup", "ress", "Hole", "s", "Counter_", "-_", "1_", ")_", "]_", ",_", "show", "In", "Stud", "y_", "=_", "True_", ",_", "name_", "=_", "\"", "Ring", "wing", "\\u", "Stru", "t", "\\u\"_", "+_", "str_", "(_", "k_", "+_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "geompy_", "._", "Rotate", "_", "(_", "mr_", "[_", "\"", "Multi", "\\u", "Rot", "ation", "\\u{", "0", "}\"_", "._", "format_", "(_", "multi", "Rot", "ation", "Counter_", "-_", "1_", ")_", "]_", ",_", "OX", "_", ",_", "45_", "*_", "math_", "._", "pi_", "/_", "180.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
mila-udem/blocks-examples/machine_translation/__init__.py
[ { "content": "import logging\n\nfrom collections import Counter\nfrom theano import tensor\nfrom toolz import merge\n\nfrom blocks.algorithms import (GradientDescent, StepClipping, AdaDelta,\n CompositeRule)\nfrom blocks.extensions import FinishAfter, Printing\nfrom blocks.extensions.monitoring import TrainingDataMonitoring\nfrom blocks.filter import VariableFilter\nfrom blocks.graph import ComputationGraph, apply_noise, apply_dropout\nfrom blocks.initialization import IsotropicGaussian, Orthogonal, Constant\nfrom blocks.main_loop import MainLoop\nfrom blocks.model import Model\nfrom blocks.select import Selector\n\nfrom machine_translation.checkpoint import CheckpointNMT, LoadNMT\nfrom machine_translation.model import BidirectionalEncoder, Decoder\nfrom machine_translation.sampling import BleuValidator, Sampler\n\ntry:\n from blocks_extras.extensions.plot import Plot\n BOKEH_AVAILABLE = True\nexcept ImportError:\n BOKEH_AVAILABLE = False\n\nlogger = logging.getLogger(__name__)\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def main(config, tr_stream, dev_stream, use_bokeh=False):\n\n # Create Theano variables\n logger.info('Creating theano variables')\n source_sentence = tensor.lmatrix('source')\n source_sentence_mask = tensor.matrix('source_mask')\n target_sentence = tensor.lmatrix('target')\n target_sentence_mask = tensor.matrix('target_mask')\n sampling_input = tensor.lmatrix('input')\n\n # Construct model\n logger.info('Building RNN encoder-decoder')\n encoder = BidirectionalEncoder(\n config['src_vocab_size'], config['enc_embed'], config['enc_nhids'])\n decoder = Decoder(\n config['trg_vocab_size'], config['dec_embed'], config['dec_nhids'],\n config['enc_nhids'] * 2)\n cost = decoder.cost(\n encoder.apply(source_sentence, source_sentence_mask),\n source_sentence_mask, target_sentence, target_sentence_mask)\n\n logger.info('Creating computational graph')\n cg = ComputationGraph(cost)\n\n # Initialize model\n logger.info('Initializing model')\n encoder.weights_init = decoder.weights_init = IsotropicGaussian(\n config['weight_scale'])\n encoder.biases_init = decoder.biases_init = Constant(0)\n encoder.push_initialization_config()\n decoder.push_initialization_config()\n encoder.bidir.prototype.weights_init = Orthogonal()\n decoder.transition.weights_init = Orthogonal()\n encoder.initialize()\n decoder.initialize()\n\n # apply dropout for regularization\n if config['dropout'] < 1.0:\n # dropout is applied to the output of maxout in ghog\n logger.info('Applying dropout')\n dropout_inputs = [x for x in cg.intermediary_variables\n if x.name == 'maxout_apply_output']\n cg = apply_dropout(cg, dropout_inputs, config['dropout'])\n\n # Apply weight noise for regularization\n if config['weight_noise_ff'] > 0.0:\n logger.info('Applying weight noise to ff layers')\n enc_params = Selector(encoder.lookup).get_params().values()\n enc_params += Selector(encoder.fwd_fork).get_params().values()\n enc_params += Selector(encoder.back_fork).get_params().values()\n dec_params = Selector(\n decoder.sequence_generator.readout).get_params().values()\n dec_params += Selector(\n decoder.sequence_generator.fork).get_params().values()\n dec_params += Selector(decoder.state_init).get_params().values()\n cg = apply_noise(cg, enc_params+dec_params, config['weight_noise_ff'])\n\n # Print shapes\n shapes = [param.get_value().shape for param in cg.parameters]\n logger.info(\"Parameter shapes: \")\n for shape, count in Counter(shapes).most_common():\n logger.info(' {:15}: {}'.format(shape, count))\n logger.info(\"Total number of parameters: {}\".format(len(shapes)))\n\n # Print parameter names\n enc_dec_param_dict = merge(Selector(encoder).get_parameters(),\n Selector(decoder).get_parameters())\n logger.info(\"Parameter names: \")\n for name, value in enc_dec_param_dict.items():\n logger.info(' {:15}: {}'.format(value.get_value().shape, name))\n logger.info(\"Total number of parameters: {}\"\n .format(len(enc_dec_param_dict)))\n\n # Set up training model\n logger.info(\"Building model\")\n training_model = Model(cost)\n\n # Set extensions\n logger.info(\"Initializing extensions\")\n extensions = [\n FinishAfter(after_n_batches=config['finish_after']),\n TrainingDataMonitoring([cost], after_batch=True),\n Printing(after_batch=True),\n CheckpointNMT(config['saveto'],\n every_n_batches=config['save_freq'])\n ]\n\n # Set up beam search and sampling computation graphs if necessary\n if config['hook_samples'] >= 1 or config['bleu_script'] is not None:\n logger.info(\"Building sampling model\")\n sampling_representation = encoder.apply(\n sampling_input, tensor.ones(sampling_input.shape))\n generated = decoder.generate(sampling_input, sampling_representation)\n search_model = Model(generated)\n _, samples = VariableFilter(\n bricks=[decoder.sequence_generator], name=\"outputs\")(\n ComputationGraph(generated[1])) # generated[1] is next_outputs\n\n # Add sampling\n if config['hook_samples'] >= 1:\n logger.info(\"Building sampler\")\n extensions.append(\n Sampler(model=search_model, data_stream=tr_stream,\n hook_samples=config['hook_samples'],\n every_n_batches=config['sampling_freq'],\n src_vocab_size=config['src_vocab_size']))\n\n # Add early stopping based on bleu\n if config['bleu_script'] is not None:\n logger.info(\"Building bleu validator\")\n extensions.append(\n BleuValidator(sampling_input, samples=samples, config=config,\n model=search_model, data_stream=dev_stream,\n normalize=config['normalized_bleu'],\n every_n_batches=config['bleu_val_freq']))\n\n # Reload model if necessary\n if config['reload']:\n extensions.append(LoadNMT(config['saveto']))\n\n # Plot cost in bokeh if necessary\n if use_bokeh and BOKEH_AVAILABLE:\n extensions.append(\n Plot('Cs-En', channels=[['decoder_cost_cost']],\n after_batch=True))\n\n # Set up training algorithm\n logger.info(\"Initializing training algorithm\")\n algorithm = GradientDescent(\n cost=cost, parameters=cg.parameters,\n step_rule=CompositeRule([StepClipping(config['step_clipping']),\n eval(config['step_rule'])()])\n )\n\n # Initialize main loop\n logger.info(\"Initializing main loop\")\n main_loop = MainLoop(\n model=training_model,\n algorithm=algorithm,\n data_stream=tr_stream,\n extensions=extensions\n )\n\n # Train!\n main_loop.run()", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 30 } ]
[ { "span": "from blocks.algorithms import (GradientDescent, StepClipping, AdaDelta,\n CompositeRule)", "start_line": 6, "start_column": 0, "end_line": 7, "end_column": 45 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "collections_", "import_", "Counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "theano_", "import_", "tensor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tool", "z_", "import_", "merge_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "blocks_", "._", "algorithms_", "import_", "(_", "Grad", "ient", "Descen", "t_", ",_", "Step", "Clip", "ping_", ",_", "Ada", "Delta_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Composit", "e", "Rule_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "blocks_", "._", "extensions_", "import_", "Finish", "After_", ",_", "Printing", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "blocks_", "._", "extensions_", "._", "monitorin", "g_", "import_", "Train", "ing", "Data", "Monitor", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "blocks_", "._", "filter_", "import_", "Varia", "ble", "Filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "blocks_", "._", "graph_", "import_", "Computation", "Graph_", ",_", "appl", "y", "\\u", "noise_", ",_", "appl", "y", "\\u", "dropout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "blocks_", "._", "initialization", "_", "import_", "Iso", "trop", "ic", "Gaussian", "_", ",_", "Ortho", "gon", "al_", ",_", "Constant_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "blocks_", "._", "main", "\\u", "loop_", "import_", "Main", "Loop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "blocks_", "._", "model_", "import_", "Model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "blocks_", "._", "select_", "import_", "Selector_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "machine", "\\u", "translation_", "._", "checkpoint_", "import_", "Checkpoint", "NM", "T_", ",_", "Load", "NM", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "machine", "\\u", "translation_", "._", "model_", "import_", "Bid", "irect", "ional", "Encoder_", ",_", "Decoder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "machine", "\\u", "translation_", "._", "sampling_", "import_", "Ble", "u", "Validator_", ",_", "Sampler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "blocks", "\\u", "extras_", "._", "extensions_", "._", "plot_", "import_", "Plot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BO", "KE", "H", "\\u", "AVAILABLE_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "BO", "KE", "H", "\\u", "AVAILABLE_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "main_", "(_", "config_", ",_", "tr", "\\u", "stream_", ",_", "dev", "\\u", "stream_", ",_", "use", "\\u", "bokeh", "_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "The", "ano", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "'", "Creat", "ing", " ", "theano", " ", "variab", "les", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "\\u", "sentence_", "=_", "tensor_", "._", "lma", "trix_", "(_", "'", "source", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "\\u", "sentence", "\\u", "mask_", "=_", "tensor_", "._", "matrix_", "(_", "'", "source", "\\u", "mask", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "sentence_", "=_", "tensor_", "._", "lma", "trix_", "(_", "'", "target", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "sentence", "\\u", "mask_", "=_", "tensor_", "._", "matrix_", "(_", "'", "target", "\\u", "mask", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "samp", "ling", "\\u", "input_", "=_", "tensor_", "._", "lma", "trix_", "(_", "'", "input", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Construct", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "Building", " ", "RN", "N", " ", "encode", "r", "-", "decode", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "encoder_", "=_", "Bid", "irect", "ional", "Encoder_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "[_", "'", "src", "\\u", "vocab", "\\u", "size", "'_", "]_", ",_", "config_", "[_", "'", "enc", "\\u", "embed", "'_", "]_", ",_", "config_", "[_", "'", "enc", "\\u", "nh", "ids", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "decoder_", "=_", "Decoder_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "[_", "'", "trg", "\\u", "vocab", "\\u", "size", "'_", "]_", ",_", "config_", "[_", "'", "dec", "\\u", "embed", "'_", "]_", ",_", "config_", "[_", "'", "dec", "\\u", "nh", "ids", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "[_", "'", "enc", "\\u", "nh", "ids", "'_", "]_", "*_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cost_", "=_", "decoder_", "._", "cost_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "encoder_", "._", "apply_", "(_", "source", "\\u", "sentence_", ",_", "source", "\\u", "sentence", "\\u", "mask_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "sentence", "\\u", "mask_", ",_", "target", "\\u", "sentence_", ",_", "target", "\\u", "sentence", "\\u", "mask_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "Creat", "ing", " ", "computation", "al", " ", "graph", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cg_", "=_", "Computation", "Graph_", "(_", "cost_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initializ", "e", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "Initializ", "ing", " ", "model", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "encoder_", "._", "weight", "s", "\\u", "init_", "=_", "decoder_", "._", "weight", "s", "\\u", "init_", "=_", "Iso", "trop", "ic", "Gaussian", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "[_", "'", "weight", "\\u", "scale", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "encoder_", "._", "bias", "es", "\\u", "init_", "=_", "decoder_", "._", "bias", "es", "\\u", "init_", "=_", "Constant_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "encoder_", "._", "push", "\\u", "initialization", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "decoder_", "._", "push", "\\u", "initialization", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "encoder_", "._", "bid", "ir_", "._", "prototype_", "._", "weight", "s", "\\u", "init_", "=_", "Ortho", "gon", "al_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "decoder_", "._", "transition_", "._", "weight", "s", "\\u", "init_", "=_", "Ortho", "gon", "al_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "encoder_", "._", "initialize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "decoder_", "._", "initialize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "appl", "y", " ", "drop", "out", " ", "for", " ", "regularization", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "config_", "[_", "'", "drop", "out", "'_", "]_", "<_", "1.0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "drop", "out", " ", "is", " ", "applied", " ", "to", " ", "the", " ", "output", " ", "of", " ", "max", "out", " ", "in", " ", "gh", "og_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "'", "Apply", "ing", " ", "drop", "out", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drop", "out", "\\u", "inputs_", "=_", "[_", "x_", "for_", "x_", "in_", "cg_", "._", "interm", "edia", "ry", "\\u", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "x_", "._", "name_", "==_", "'", "max", "out", "\\u", "appl", "y", "\\u", "output", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cg_", "=_", "appl", "y", "\\u", "dropout_", "(_", "cg_", ",_", "drop", "out", "\\u", "inputs_", ",_", "config_", "[_", "'", "drop", "out", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Apply", " ", "weight", " ", "noise", " ", "for", " ", "regularization", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "config_", "[_", "'", "weight", "\\u", "noise", "\\u", "ff", "'_", "]_", ">_", "0.0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "'", "Apply", "ing", " ", "weight", " ", "noise", " ", "to", " ", "ff", " ", "layer", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "enc", "\\u", "params_", "=_", "Selector_", "(_", "encoder_", "._", "lookup_", ")_", "._", "get", "\\u", "params_", "(_", ")_", "._", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "enc", "\\u", "params_", "+=_", "Selector_", "(_", "encoder_", "._", "fw", "d\\u", "fork_", ")_", "._", "get", "\\u", "params_", "(_", ")_", "._", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "enc", "\\u", "params_", "+=_", "Selector_", "(_", "encoder_", "._", "back", "\\u", "fork_", ")_", "._", "get", "\\u", "params_", "(_", ")_", "._", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dec", "\\u", "params_", "=_", "Selector_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "decoder_", "._", "sequence", "\\u", "generator_", "._", "readout", "_", ")_", "._", "get", "\\u", "params_", "(_", ")_", "._", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dec", "\\u", "params_", "+=_", "Selector_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "decoder_", "._", "sequence", "\\u", "generator_", "._", "fork_", ")_", "._", "get", "\\u", "params_", "(_", ")_", "._", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dec", "\\u", "params_", "+=_", "Selector_", "(_", "decoder_", "._", "state", "\\u", "init_", ")_", "._", "get", "\\u", "params_", "(_", ")_", "._", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cg_", "=_", "appl", "y", "\\u", "noise_", "(_", "cg_", ",_", "enc", "\\u", "params_", "+_", "dec", "\\u", "params_", ",_", "config_", "[_", "'", "weight", "\\u", "noise", "\\u", "ff", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Print", " ", "shapes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shapes_", "=_", "[_", "param_", "._", "get", "\\u", "value_", "(_", ")_", "._", "shape_", "for_", "param_", "in_", "cg_", "._", "parameters_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Parameter", " ", "shape", "s", ":", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "shape_", ",_", "count_", "in_", "Counter_", "(_", "shapes_", ")_", "._", "most", "\\u", "common_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "'", " ", " ", " ", " ", "{:", "15", "}:", " ", "{}'_", "._", "format_", "(_", "shape_", ",_", "count_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Total", " ", "number", " ", "of", " ", "parameter", "s", ":", " ", "{}\"_", "._", "format_", "(_", "len_", "(_", "shapes_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Print", " ", "parameter", " ", "names_", "\\u\\u\\uNL\\u\\u\\u_", "enc", "\\u", "dec", "\\u", "param", "\\u", "dict_", "=_", "merge_", "(_", "Selector_", "(_", "encoder_", ")_", "._", "get", "\\u", "parameters_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Selector_", "(_", "decoder_", ")_", "._", "get", "\\u", "parameters_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Parameter", " ", "names", ":", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", ",_", "value_", "in_", "enc", "\\u", "dec", "\\u", "param", "\\u", "dict_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "'", " ", " ", " ", " ", "{:", "15", "}:", " ", "{}'_", "._", "format_", "(_", "value_", "._", "get", "\\u", "value_", "(_", ")_", "._", "shape_", ",_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Total", " ", "number", " ", "of", " ", "parameter", "s", ":", " ", "{}\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "len_", "(_", "enc", "\\u", "dec", "\\u", "param", "\\u", "dict_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "up", " ", "train", "ing", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Building", " ", "model", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train", "ing", "\\u", "model_", "=_", "Model_", "(_", "cost_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "extensions_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Initializ", "ing", " ", "extensi", "ons", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extensions_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Finish", "After_", "(_", "after", "\\u", "n", "\\u", "batches_", "=_", "config_", "[_", "'", "finish", "\\u", "after", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Train", "ing", "Data", "Monitor", "ing_", "(_", "[_", "cost_", "]_", ",_", "after", "\\u", "batch_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Printing", "_", "(_", "after", "\\u", "batch_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Checkpoint", "NM", "T_", "(_", "config_", "[_", "'", "save", "to", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "every", "\\u", "n", "\\u", "batches_", "=_", "config_", "[_", "'", "save", "\\u", "freq", "'_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "up", " ", "beam", " ", "search", " ", "and", " ", "samp", "ling", " ", "computation", " ", "graph", "s", " ", "if", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "config_", "[_", "'", "hook", "\\u", "samples", "'_", "]_", ">=_", "1_", "or_", "config_", "[_", "'", "ble", "u\\u", "script", "'_", "]_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\"", "Building", " ", "samp", "ling", " ", "model", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "samp", "ling", "\\u", "representation_", "=_", "encoder_", "._", "apply_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "samp", "ling", "\\u", "input_", ",_", "tensor_", "._", "ones_", "(_", "samp", "ling", "\\u", "input_", "._", "shape_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "generated_", "=_", "decoder_", "._", "generate_", "(_", "samp", "ling", "\\u", "input_", ",_", "samp", "ling", "\\u", "representation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "\\u", "model_", "=_", "Model_", "(_", "generated_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "samples_", "=_", "Varia", "ble", "Filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "bricks", "_", "=_", "[_", "decoder_", "._", "sequence", "\\u", "generator_", "]_", ",_", "name_", "=_", "\"", "output", "s", "\"_", ")_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Computation", "Graph_", "(_", "generated_", "[_", "1_", "]_", ")_", ")_", "#", " ", "generat", "ed", "[", "1", "]", " ", "is", " ", "next", "\\u", "outputs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "sampling_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "config_", "[_", "'", "hook", "\\u", "samples", "'_", "]_", ">=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\"", "Building", " ", "sampler", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extensions_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Sampler_", "(_", "model_", "=_", "search", "\\u", "model_", ",_", "data\\u", "stream_", "=_", "tr", "\\u", "stream_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hook", "\\u", "samples_", "=_", "config_", "[_", "'", "hook", "\\u", "samples", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "every", "\\u", "n", "\\u", "batches_", "=_", "config_", "[_", "'", "samp", "ling", "\\u", "freq", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "src", "\\u", "vocab", "\\u", "size_", "=_", "config_", "[_", "'", "src", "\\u", "vocab", "\\u", "size", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "ear", "ly", " ", "stopping", " ", "based", " ", "on", " ", "ble", "u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "config_", "[_", "'", "ble", "u\\u", "script", "'_", "]_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\"", "Building", " ", "ble", "u", " ", "validator", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extensions_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Ble", "u", "Validator_", "(_", "samp", "ling", "\\u", "input_", ",_", "samples_", "=_", "samples_", ",_", "config_", "=_", "config_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "=_", "search", "\\u", "model_", ",_", "data\\u", "stream_", "=_", "dev", "\\u", "stream_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "normalize_", "=_", "config_", "[_", "'", "normali", "zed", "\\u", "ble", "u", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "every", "\\u", "n", "\\u", "batches_", "=_", "config_", "[_", "'", "ble", "u\\u", "val", "\\u", "freq", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Relo", "ad", " ", "model", " ", "if", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "config_", "[_", "'", "relo", "ad", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extensions_", "._", "append_", "(_", "Load", "NM", "T_", "(_", "config_", "[_", "'", "save", "to", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Plot", " ", "cost", " ", "in", " ", "bokeh", " ", "if", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "use", "\\u", "bokeh", "_", "and_", "BO", "KE", "H", "\\u", "AVAILABLE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extensions_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Plot_", "(_", "'", "Cs", "-", "En", "'_", ",_", "channels_", "=_", "[_", "[_", "'", "decode", "r", "\\u", "cost", "\\u", "cost", "'_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "after", "\\u", "batch_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "up", " ", "train", "ing", " ", "algorithm_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Initializ", "ing", " ", "train", "ing", " ", "algo", "rit", "hm", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "algorithm_", "=_", "Grad", "ient", "Descen", "t_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "cost_", "=_", "cost_", ",_", "parameters_", "=_", "cg_", "._", "parameters_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "step", "\\u", "rule_", "=_", "Composit", "e", "Rule_", "(_", "[_", "Step", "Clip", "ping_", "(_", "config_", "[_", "'", "step", "\\u", "clipping", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "eval_", "(_", "config_", "[_", "'", "step", "\\u", "rule", "'_", "]_", ")_", "(_", ")_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initializ", "e", " ", "main", " ", "loop_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Initializ", "ing", " ", "main", " ", "loop", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "main", "\\u", "loop_", "=_", "Main", "Loop_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "=_", "train", "ing", "\\u", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "algorithm_", "=_", "algorithm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "stream_", "=_", "tr", "\\u", "stream_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "=_", "extensions_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Train", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "main", "\\u", "loop_", "._", "run_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
VisTrails/VisTrails/vistrails/core/vistrail/controller.py
[ { "content": " def connect_vistrail_var(self, descriptor, var_uuid,\n to_module, to_port, x, y):\n ops = []\n new_module = None\n v_module = self.find_vistrail_var_module(var_uuid)\n if v_module is None:\n v_module = self.create_vistrail_var_module(descriptor, x, y, \n var_uuid)\n new_module = v_module\n elif self.check_vistrail_var_connected(v_module, to_module, to_port):\n return (None, None)\n\n c = self.create_connection(v_module, \"value\", to_module, to_port)\n action = self.connect_vistrail_var_action(c, new_module)\n return (c, new_module)", "metadata": "root.VistrailController.connect_vistrail_var", "header": "['class', 'VistrailController', '(', 'object', ')', ':', '___EOS___']", "index": 398 }, { "content": " def add_module_from_descriptor(self, descriptor, x=0.0, y=0.0, \n internal_version=-1):\n module = self.create_module_from_descriptor(descriptor, x, y, \n internal_version)\n action = self.add_module_action(module)\n return module", "metadata": "root.VistrailController.add_module_from_descriptor", "header": "['class', 'VistrailController', '(', 'object', ')', ':', '___EOS___']", "index": 1041 }, { "content": " def add_module(self, identifier, name, namespace='', x=0.0, y=0.0, \n internal_version=-1):\n \"\"\" addModule(x: int, y: int, identifier, name: str, namespace='') \n -> Module\n Add a new module into the current pipeline\n \n \"\"\"\n module = self.create_module(identifier, name, namespace, x, y,\n internal_version)\n action = self.add_module_action(module)\n return module", "metadata": "root.VistrailController.add_module", "header": "['class', 'VistrailController', '(', 'object', ')', ':', '___EOS___']", "index": 1048 }, { "content": " def add_connection(self, output_id, output_port_spec, \n input_id, input_port_spec):\n \"\"\" add_connection(output_id: long,\n output_port_spec: PortSpec | str,\n input_id: long,\n input_port_spec: PortSpec | str) -> Connection\n Add a new connection into Vistrail\n \n \"\"\"\n connection = \\\n self.create_connection_from_ids(output_id, output_port_spec, \n input_id, input_port_spec)\n action = self.add_connection_action(connection)\n return connection", "metadata": "root.VistrailController.add_connection", "header": "['class', 'VistrailController', '(', 'object', ')', ':', '___EOS___']", "index": 1126 }, { "content": " def add_function(self, module, function_name):\n function = self.create_function(module, function_name)\n action = self.add_function_action(module, function)\n return function", "metadata": "root.VistrailController.add_function", "header": "['class', 'VistrailController', '(', 'object', ')', ':', '___EOS___']", "index": 1167 }, { "content": " @vt_action\n def delete_module_port(self, module_id, port_tuple):\n \"\"\"\n Parameters\n ----------\n \n - module_id : 'int'\n - port_tuple : (portType, portName, portSpec)\n \n \"\"\"\n spec_id = -1\n module = self.current_pipeline.get_module_by_id(module_id)\n port_spec = module.get_portSpec_by_name((port_tuple[1], port_tuple[0]))\n action_list = [('delete', port_spec, module.vtType, module.id)]\n for function in module.functions:\n if function.name == port_spec.name:\n action_list.append(('delete', function, \n module.vtType, module.id))\n action = vistrails.core.db.action.create_action(action_list)\n return action", "metadata": "root.VistrailController.delete_module_port", "header": "['class', 'VistrailController', '(', 'object', ')', ':', '___EOS___']", "index": 1374 }, { "content": " def create_group(self, module_ids, connection_ids):\n self.flush_delayed_actions()\n (group, connections) = \\\n self.build_group(self.current_pipeline, \n module_ids, connection_ids)\n op_list = []\n op_list.extend(('delete', self.current_pipeline.connections[c_id])\n for c_id in connection_ids)\n op_list.extend(('delete', self.current_pipeline.modules[m_id]) \n for m_id in module_ids)\n op_list.append(('add', group))\n op_list.extend(('add', c) for c in connections)\n action = vistrails.core.db.action.create_action(op_list)\n self.set_action_annotation(action, Action.ANNOTATION_DESCRIPTION,\n \"Grouped modules\")\n self.add_new_action(action)\n# for op in action.operations:\n# print op.vtType, op.what, op.old_obj_id, op.new_obj_id\n result = self.perform_action(action)\n return group", "metadata": "root.VistrailController.create_group", "header": "['class', 'VistrailController', '(', 'object', ')', ':', '___EOS___']", "index": 1395 }, { "content": " def create_abstraction(self, module_ids, connection_ids, name):\n self.flush_delayed_actions()\n (abstraction, connections) = \\\n self.build_abstraction(self.current_pipeline, \n module_ids, connection_ids, name)\n op_list = []\n op_list.extend(('delete', self.current_pipeline.connections[c_id])\n for c_id in connection_ids)\n op_list.extend(('delete', self.current_pipeline.modules[m_id]) \n for m_id in module_ids)\n op_list.append(('add', abstraction))\n op_list.extend(('add', c) for c in connections)\n action = vistrails.core.db.action.create_action(op_list)\n self.add_new_action(action)\n result = self.perform_action(action)\n return abstraction", "metadata": "root.VistrailController.create_abstraction", "header": "['class', 'VistrailController', '(', 'object', ')', ':', '___EOS___']", "index": 1416 }, { "content": " def get_abstraction_dir(self):\n conf = get_vistrails_configuration()\n abstraction_dir = get_vistrails_directory(\"subworkflowsDir\")\n if abstraction_dir is None:\n raise VistrailsInternalError(\"'subworkflowsDir' not\"\n \" specified in configuration\")\n elif not os.path.exists(abstraction_dir):\n raise VistrailsInternalError(\"Cannot find %s\" % abstraction_dir)\n return abstraction_dir", "metadata": "root.VistrailController.get_abstraction_dir", "header": "['class', 'VistrailController', '(', 'object', ')', ':', '___EOS___']", "index": 1880 }, { "content": " def load_abstraction(self, abs_fname, is_global=True, abs_name=None,\n module_version=None, avail_fnames=[]):\n if abs_name is None:\n abs_name = parse_abstraction_name(abs_fname)\n if abs_fname in self._loaded_abstractions:\n abs_vistrail = self._loaded_abstractions[abs_fname]\n else:\n abs_vistrail = read_vistrail(abs_fname)\n self._loaded_abstractions[abs_fname] = abs_vistrail\n \n # print \"LOAD_VT NAMESPACES:\", get_all_abs_namespaces(abs_vistrail)\n\n abstraction_uuid = get_cur_abs_namespace(abs_vistrail)\n if abstraction_uuid is None:\n # No current uuid exists - generate one\n abstraction_uuid = str(uuid.uuid1())\n abs_vistrail.set_annotation('__abstraction_uuid__', abstraction_uuid)\n origin_uuid = abs_vistrail.get_annotation('__abstraction_origin_uuid__')\n if origin_uuid is None:\n # No origin uuid exists - set to current uuid (for backwards compatibility)\n origin_uuid = abstraction_uuid\n abs_vistrail.set_annotation('__abstraction_origin_uuid__', origin_uuid)\n else:\n origin_uuid = origin_uuid.value\n \n if module_version is None:\n module_version = str(abs_vistrail.get_latest_version())\n elif isinstance(module_version, (int, long)):\n module_version = str(module_version)\n # If an upgraded version has already been created, we want to use that rather than loading the old version.\n # This step also avoid duplication of abstraction upgrades. Otherwise, when we try to add the old version\n # to the registry, it raises an InvalidPipeline exception and automatically tries to handle it by creating\n # another upgrade for the old version.\n upgrade_version = abs_vistrail.get_upgrade(long(module_version))\n if upgrade_version is not None:\n old_version = module_version\n module_version = str(upgrade_version)\n \n desc = self.get_abstraction_desc(abstraction_pkg, abs_name, \n abstraction_uuid, module_version)\n if desc is None:\n #print \"adding version\", module_version, \"of\", abs_name, \"(namespace: %s)\"%abstraction_uuid, \"to registry\"\n desc = self.add_abstraction_to_registry(abs_vistrail, abs_fname, \n abs_name, None, \n module_version, \n is_global, avail_fnames)\n return desc", "metadata": "root.VistrailController.load_abstraction", "header": "['class', 'VistrailController', '(', 'object', ')', ':', '___EOS___']", "index": 2001 }, { "content": " def add_parameter_changes_from_execution(self, pipeline, version,\n parameter_changes):\n \"\"\"add_parameter_changes_from_execution(pipeline, version,\n parameter_changes) -> int.\n\n Adds new versions to the current vistrail as a result of an\n execution. Returns the version number of the new version.\"\"\"\n\n current_pipeline = self.current_pipeline\n current_version = self.current_version\n\n self.current_pipeline = pipeline\n self.current_version = version\n\n op_list = []\n for (m_id, function_name, param_values) in parameter_changes:\n try:\n param_values_len = len(param_values)\n except TypeError:\n param_values = [param_values]\n # FIXME should use registry to determine parameter types\n # and then call the translate_to_string method on each\n # parameter\n param_values = [str(x) for x in param_values]\n module = self.current_pipeline.modules[m_id]\n # FIXME remove this code when aliases move\n old_id = -1\n for old_function in module.functions:\n if old_function.name == function_name:\n old_id = old_function.real_id\n\n # ensure that replacements don't happen for functions that\n # shouldn't be replaced\n aliases = []\n if old_id >= 0:\n function = module.function_idx[old_id]\n for i in xrange(len(param_values)):\n aliases.append(function.params[i].alias)\n \n op_list.extend(self.update_function_ops(module, function_name, \n param_values,\n should_replace=True, \n aliases=aliases))\n\n action = vistrails.core.db.action.create_action(op_list)\n self.add_new_action(action)\n\n self.current_pipeline = current_pipeline\n self.current_version = current_version\n \n return action.id", "metadata": "root.VistrailController.add_parameter_changes_from_execution", "header": "['class', 'VistrailController', '(', 'object', ')', ':', '___EOS___']", "index": 2536 } ]
[ { "span": "ops ", "start_line": 400, "start_column": 8, "end_line": 400, "end_column": 11 }, { "span": "action ", "start_line": 411, "start_column": 8, "end_line": 411, "end_column": 14 }, { "span": "action ", "start_line": 1045, "start_column": 8, "end_line": 1045, "end_column": 14 }, { "span": "action ", "start_line": 1057, "start_column": 8, "end_line": 1057, "end_column": 14 }, { "span": "action ", "start_line": 1138, "start_column": 8, "end_line": 1138, "end_column": 14 }, { "span": "action ", "start_line": 1169, "start_column": 8, "end_line": 1169, "end_column": 14 }, { "span": "spec_id ", "start_line": 1384, "start_column": 8, "end_line": 1384, "end_column": 15 }, { "span": "result ", "start_line": 1413, "start_column": 8, "end_line": 1413, "end_column": 14 }, { "span": "result ", "start_line": 1430, "start_column": 8, "end_line": 1430, "end_column": 14 }, { "span": "conf ", "start_line": 1881, "start_column": 8, "end_line": 1881, "end_column": 12 }, { "span": "origin_uuid ", "start_line": 2024, "start_column": 12, "end_line": 2024, "end_column": 23 }, { "span": "old_version ", "start_line": 2036, "start_column": 12, "end_line": 2036, "end_column": 23 }, { "span": "param_values_len ", "start_line": 2553, "start_column": 16, "end_line": 2553, "end_column": 32 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Vis", "trail", "Controller_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "connect", "\\u", "vist", "rail", "\\u", "var_", "(_", "self_", ",_", "descriptor_", ",_", "var", "\\u", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "module_", ",_", "to", "\\u", "port_", ",_", "x_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ops_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "module_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "\\u", "module_", "=_", "self_", "._", "find", "\\u", "vist", "rail", "\\u", "var", "\\u", "module_", "(_", "var", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "v", "\\u", "module_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v", "\\u", "module_", "=_", "self_", "._", "create", "\\u", "vist", "rail", "\\u", "var", "\\u", "module_", "(_", "descriptor_", ",_", "x_", ",_", "y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "var", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "module_", "=_", "v", "\\u", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "check", "\\u", "vist", "rail", "\\u", "var", "\\u", "connected_", "(_", "v", "\\u", "module_", ",_", "to", "\\u", "module_", ",_", "to", "\\u", "port_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c_", "=_", "self_", "._", "create", "\\u", "connection_", "(_", "v", "\\u", "module_", ",_", "\"", "value", "\"_", ",_", "to", "\\u", "module_", ",_", "to", "\\u", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action_", "=_", "self_", "._", "connect", "\\u", "vist", "rail", "\\u", "var", "\\u", "action_", "(_", "c_", ",_", "new", "\\u", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "c_", ",_", "new", "\\u", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vis", "trail", "Controller_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "module", "\\u", "from", "\\u", "descriptor_", "(_", "self_", ",_", "descriptor_", ",_", "x_", "=_", "0.0_", ",_", "y_", "=_", "0.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "internal", "\\u", "version_", "=_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module_", "=_", "self_", "._", "create", "\\u", "module", "\\u", "from", "\\u", "descriptor_", "(_", "descriptor_", ",_", "x_", ",_", "y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "internal", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action_", "=_", "self_", "._", "add", "\\u", "module", "\\u", "action_", "(_", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vis", "trail", "Controller_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "module_", "(_", "self_", ",_", "identifier_", ",_", "name_", ",_", "namespace_", "=_", "''_", ",_", "x_", "=_", "0.0_", ",_", "y_", "=_", "0.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "internal", "\\u", "version_", "=_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "add", "Modul", "e", "(", "x", ":", " ", "int", ",", " ", "y", ":", " ", "int", ",", " ", "identifi", "er", ",", " ", "name", ":", " ", "str", ",", " ", "namespace", "=''", ")", " ", "\\", "10", ";", " ", " ", " ", "->", " ", "Modul", "e", "\\", "10", ";", " ", " ", " ", " ", "Add", " ", "a", " ", "new", " ", "module", " ", "int", "o", " ", "the", " ", "current", " ", "pipeline", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module_", "=_", "self_", "._", "create", "\\u", "module_", "(_", "identifier_", ",_", "name_", ",_", "namespace_", ",_", "x_", ",_", "y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "internal", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action_", "=_", "self_", "._", "add", "\\u", "module", "\\u", "action_", "(_", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vis", "trail", "Controller_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "connection_", "(_", "self_", ",_", "output", "\\u", "id_", ",_", "output", "\\u", "port", "\\u", "spec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "id_", ",_", "input", "\\u", "port", "\\u", "spec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "add", "\\u", "connecti", "on", "(", "output", "\\u", "id", ":", " ", "long", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "output", "\\u", "port", "\\u", "spec", ":", " ", "Port", "Spec", " ", "|", " ", "str", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "input", "\\u", "id", ":", " ", "long", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "input", "\\u", "port", "\\u", "spec", ":", " ", "Port", "Spec", " ", "|", " ", "str", ")", " ", "->", " ", "Connect", "ion", "\\", "10", ";", " ", " ", " ", " ", "Add", " ", "a", " ", "new", " ", "connecti", "on", " ", "int", "o", " ", "Vis", "trail", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connection_", "=_", "self_", "._", "create", "\\u", "connecti", "on", "\\u", "from", "\\u", "ids_", "(_", "output", "\\u", "id_", ",_", "output", "\\u", "port", "\\u", "spec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "id_", ",_", "input", "\\u", "port", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action_", "=_", "self_", "._", "add", "\\u", "connecti", "on", "\\u", "action_", "(_", "connection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vis", "trail", "Controller_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "function_", "(_", "self_", ",_", "module_", ",_", "function", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "function_", "=_", "self_", "._", "create", "\\u", "function_", "(_", "module_", ",_", "function", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action_", "=_", "self_", "._", "add", "\\u", "function", "\\u", "action_", "(_", "module_", ",_", "function_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vis", "trail", "Controller_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "vt", "\\u", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "delete", "\\u", "module", "\\u", "port_", "(_", "self_", ",_", "module", "\\u", "id_", ",_", "port", "\\u", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "module", "\\u", "id", " ", ":", " ", "'", "int", "'", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "port", "\\u", "tuple", " ", ":", " ", "(", "port", "Type", ",", " ", "port", "Name", ",", " ", "port", "Spec", ")", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spec", "\\u", "id_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module_", "=_", "self_", "._", "current", "\\u", "pipeline_", "._", "get", "\\u", "module", "\\u", "by", "\\u", "id_", "(_", "module", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port", "\\u", "spec_", "=_", "module_", "._", "get", "\\u", "port", "Spec", "\\u", "by", "\\u", "name_", "(_", "(_", "port", "\\u", "tuple_", "[_", "1_", "]_", ",_", "port", "\\u", "tuple_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action", "\\u", "list_", "=_", "[_", "(_", "'", "delete", "'_", ",_", "port", "\\u", "spec_", ",_", "module_", "._", "vt", "Type_", ",_", "module_", "._", "id_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "function_", "in_", "module_", "._", "functions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "function_", "._", "name_", "==_", "port", "\\u", "spec_", "._", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "action", "\\u", "list_", "._", "append_", "(_", "(_", "'", "delete", "'_", ",_", "function_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module_", "._", "vt", "Type_", ",_", "module_", "._", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "action_", "=_", "vist", "rail", "s_", "._", "core_", "._", "db_", "._", "action_", "._", "create", "\\u", "action_", "(_", "action", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vis", "trail", "Controller_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "group_", "(_", "self_", ",_", "module", "\\u", "ids_", ",_", "connecti", "on", "\\u", "ids_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "flush", "\\u", "delayed", "\\u", "actions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "group_", ",_", "connections_", ")_", "=_", "self_", "._", "build", "\\u", "group_", "(_", "self_", "._", "current", "\\u", "pipeline_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module", "\\u", "ids_", ",_", "connecti", "on", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "op", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "op", "\\u", "list_", "._", "extend_", "(_", "(_", "'", "delete", "'_", ",_", "self_", "._", "current", "\\u", "pipeline_", "._", "connections_", "[_", "c\\u", "id_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "c\\u", "id_", "in_", "connecti", "on", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "op", "\\u", "list_", "._", "extend_", "(_", "(_", "'", "delete", "'_", ",_", "self_", "._", "current", "\\u", "pipeline_", "._", "modules_", "[_", "m", "\\u", "id_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "m", "\\u", "id_", "in_", "module", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "op", "\\u", "list_", "._", "append_", "(_", "(_", "'", "add", "'_", ",_", "group_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "op", "\\u", "list_", "._", "extend_", "(_", "(_", "'", "add", "'_", ",_", "c_", ")_", "for_", "c_", "in_", "connections_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action_", "=_", "vist", "rail", "s_", "._", "core_", "._", "db_", "._", "action_", "._", "create", "\\u", "action_", "(_", "op", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "action", "\\u", "annotation_", "(_", "action_", ",_", "Action_", "._", "ANNOTAT", "ION", "\\u", "DESCRIPTION_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Groupe", "d", " ", "module", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "new", "\\u", "action_", "(_", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "for", " ", "op", " ", "in", " ", "action", ".", "operati", "ons", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "print", " ", "op", ".", "vt", "Type", ",", " ", "op", ".", "what", ",", " ", "op", ".", "old", "\\u", "obj", "\\u", "id", ",", " ", "op", ".", "new", "\\u", "obj", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "self_", "._", "perform", "\\u", "action_", "(_", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vis", "trail", "Controller_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "abstract", "ion_", "(_", "self_", ",_", "module", "\\u", "ids_", ",_", "connecti", "on", "\\u", "ids_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "flush", "\\u", "delayed", "\\u", "actions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "abstract", "ion_", ",_", "connections_", ")_", "=_", "self_", "._", "build", "\\u", "abstract", "ion_", "(_", "self_", "._", "current", "\\u", "pipeline_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module", "\\u", "ids_", ",_", "connecti", "on", "\\u", "ids_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "op", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "op", "\\u", "list_", "._", "extend_", "(_", "(_", "'", "delete", "'_", ",_", "self_", "._", "current", "\\u", "pipeline_", "._", "connections_", "[_", "c\\u", "id_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "c\\u", "id_", "in_", "connecti", "on", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "op", "\\u", "list_", "._", "extend_", "(_", "(_", "'", "delete", "'_", ",_", "self_", "._", "current", "\\u", "pipeline_", "._", "modules_", "[_", "m", "\\u", "id_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "m", "\\u", "id_", "in_", "module", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "op", "\\u", "list_", "._", "append_", "(_", "(_", "'", "add", "'_", ",_", "abstract", "ion_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "op", "\\u", "list_", "._", "extend_", "(_", "(_", "'", "add", "'_", ",_", "c_", ")_", "for_", "c_", "in_", "connections_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action_", "=_", "vist", "rail", "s_", "._", "core_", "._", "db_", "._", "action_", "._", "create", "\\u", "action_", "(_", "op", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "new", "\\u", "action_", "(_", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "perform", "\\u", "action_", "(_", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "abstract", "ion_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vis", "trail", "Controller_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "abstract", "ion", "\\u", "dir_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conf_", "=_", "get", "\\u", "vist", "rail", "s", "\\u", "configuration_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abstract", "ion", "\\u", "dir_", "=_", "get", "\\u", "vist", "rail", "s", "\\u", "directory_", "(_", "\"", "subw", "ork", "flow", "s", "Dir", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "abstract", "ion", "\\u", "dir_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Vis", "trail", "s", "Intern", "al", "Error_", "(_", "\"'", "subw", "ork", "flow", "s", "Dir", "'", " ", "not", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "specified", " ", "in", " ", "configura", "tion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "abstract", "ion", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Vis", "trail", "s", "Intern", "al", "Error_", "(_", "\"", "Cann", "ot", " ", "find", " ", "%", "s", "\"_", "%_", "abstract", "ion", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "abstract", "ion", "\\u", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vis", "trail", "Controller_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "\\u", "abstract", "ion_", "(_", "self_", ",_", "abs", "\\u", "fname_", ",_", "is", "\\u", "global_", "=_", "True_", ",_", "abs", "\\u", "name_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module", "\\u", "version_", "=_", "None_", ",_", "avail", "\\u", "fnames_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "abs", "\\u", "name_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abs", "\\u", "name_", "=_", "parse", "\\u", "abstract", "ion", "\\u", "name_", "(_", "abs", "\\u", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "abs", "\\u", "fname_", "in_", "self_", "._", "\\u", "load", "ed", "\\u", "abstract", "ions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abs", "\\u", "vist", "rail", "_", "=_", "self_", "._", "\\u", "load", "ed", "\\u", "abstract", "ions_", "[_", "abs", "\\u", "fname_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abs", "\\u", "vist", "rail", "_", "=_", "read", "\\u", "vist", "rail", "_", "(_", "abs", "\\u", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "load", "ed", "\\u", "abstract", "ions_", "[_", "abs", "\\u", "fname_", "]_", "=_", "abs", "\\u", "vist", "rail", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "\"", "LOAD", "\\u", "VT", " ", "NAMESPACE", "S", ":\"", ",", " ", "get", "\\u", "all", "\\u", "abs", "\\u", "namespace", "s", "(", "abs", "\\u", "vist", "rail", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "abstract", "ion", "\\u", "uuid_", "=_", "get", "\\u", "cur", "\\u", "abs", "\\u", "namespace_", "(_", "abs", "\\u", "vist", "rail", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "abstract", "ion", "\\u", "uuid_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "current", " ", "uuid", " ", "exist", "s", " ", "-", " ", "generat", "e", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abstract", "ion", "\\u", "uuid_", "=_", "str_", "(_", "uuid_", "._", "uuid1_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abs", "\\u", "vist", "rail", "_", "._", "set\\u", "annotation_", "(_", "'\\u", "\\u", "abstract", "ion", "\\u", "uuid", "\\u\\u'_", ",_", "abstract", "ion", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "orig", "in", "\\u", "uuid_", "=_", "abs", "\\u", "vist", "rail", "_", "._", "get", "\\u", "annotation_", "(_", "'\\u", "\\u", "abstract", "ion", "\\u", "orig", "in", "\\u", "uuid", "\\u\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "orig", "in", "\\u", "uuid_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "orig", "in", " ", "uuid", " ", "exist", "s", " ", "-", " ", "set", " ", "to", " ", "current", " ", "uuid", " ", "(", "for", " ", "back", "ward", "s", " ", "compatibility", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orig", "in", "\\u", "uuid_", "=_", "abstract", "ion", "\\u", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abs", "\\u", "vist", "rail", "_", "._", "set\\u", "annotation_", "(_", "'\\u", "\\u", "abstract", "ion", "\\u", "orig", "in", "\\u", "uuid", "\\u\\u'_", ",_", "orig", "in", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orig", "in", "\\u", "uuid_", "=_", "orig", "in", "\\u", "uuid_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "module", "\\u", "version_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module", "\\u", "version_", "=_", "str_", "(_", "abs", "\\u", "vist", "rail", "_", "._", "get", "\\u", "late", "st", "\\u", "version_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "module", "\\u", "version_", ",_", "(_", "int_", ",_", "long_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module", "\\u", "version_", "=_", "str_", "(_", "module", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "an", " ", "upgrade", "d", " ", "version", " ", "has", " ", "alr", "ead", "y", " ", "bee", "n", " ", "created", ",", " ", "we", " ", "want", " ", "to", " ", "use", " ", "tha", "t", " ", "rat", "her", " ", "than", " ", "load", "ing", " ", "the", " ", "old", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "step", " ", "als", "o", " ", "avoid", " ", "duplicat", "ion", " ", "of", " ", "abstract", "ion", " ", "upgrade", "s", ".", " ", " ", "Ot", "her", "wis", "e", ",", " ", "whe", "n", " ", "we", " ", "try", " ", "to", " ", "add", " ", "the", " ", "old", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "the", " ", "registr", "y", ",", " ", "it", " ", "raise", "s", " ", "an", " ", "Inva", "lid", "Pipe", "line", " ", "exception", " ", "and", " ", "automati", "call", "y", " ", "trie", "s", " ", "to", " ", "handle", " ", "it", " ", "by", " ", "creati", "ng_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "anot", "her", " ", "upgrade", " ", "for", " ", "the", " ", "old", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "upgrade", "\\u", "version_", "=_", "abs", "\\u", "vist", "rail", "_", "._", "get", "\\u", "upgrade_", "(_", "long_", "(_", "module", "\\u", "version_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "upgrade", "\\u", "version_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "version_", "=_", "module", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "\\u", "version_", "=_", "str_", "(_", "upgrade", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "desc_", "=_", "self_", "._", "get", "\\u", "abstract", "ion", "\\u", "desc_", "(_", "abstract", "ion", "\\u", "pkg_", ",_", "abs", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "abstract", "ion", "\\u", "uuid_", ",_", "module", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "desc_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "addin", "g", " ", "version", "\",", " ", "module", "\\u", "version", ",", " ", "\"", "of", "\",", " ", "abs", "\\u", "name", ",", " ", "\"(", "namespace", ":", " ", "%", "s", ")\"", "%", "abstract", "ion", "\\u", "uuid", ",", " ", "\"", "to", " ", "registr", "y", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "desc_", "=_", "self_", "._", "add", "\\u", "abstract", "ion", "\\u", "to", "\\u", "registry_", "(_", "abs", "\\u", "vist", "rail", "_", ",_", "abs", "\\u", "fname_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "abs", "\\u", "name_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module", "\\u", "version_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "global_", ",_", "avail", "\\u", "fnames_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "desc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vis", "trail", "Controller_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "parameter", "\\u", "change", "s", "\\u", "from", "\\u", "execution_", "(_", "self_", ",_", "pipeline_", ",_", "version_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parameter", "\\u", "changes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "add", "\\u", "parameter", "\\u", "change", "s", "\\u", "from", "\\u", "executi", "on", "(", "pipeline", ",", " ", "version", ",", "\\", "10", ";", " ", " ", " ", " ", "parameter", "\\u", "change", "s", ")", " ", "->", " ", "int", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Add", "s", " ", "new", " ", "version", "s", " ", "to", " ", "the", " ", "current", " ", "vist", "rail", " ", "as", " ", "a", " ", "result", " ", "of", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "executi", "on", ".", " ", "Return", "s", " ", "the", " ", "version", " ", "number", " ", "of", " ", "the", " ", "new", " ", "version", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "pipeline_", "=_", "self_", "._", "current", "\\u", "pipeline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "version_", "=_", "self_", "._", "current", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "current", "\\u", "pipeline_", "=_", "pipeline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "current", "\\u", "version_", "=_", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "op", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "m", "\\u", "id_", ",_", "function", "\\u", "name_", ",_", "param", "\\u", "values_", ")_", "in_", "parameter", "\\u", "changes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param", "\\u", "values", "\\u", "len_", "=_", "len_", "(_", "param", "\\u", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param", "\\u", "values_", "=_", "[_", "param", "\\u", "values_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "FIX", "ME", " ", "shou", "ld", " ", "use", " ", "registr", "y", " ", "to", " ", "dete", "rmin", "e", " ", "parameter", " ", "types_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "then", " ", "call", " ", "the", " ", "translat", "e\\u", "to", "\\u", "string", " ", "method", " ", "on", " ", "each_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parameter_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "param", "\\u", "values_", "=_", "[_", "str_", "(_", "x_", ")_", "for_", "x_", "in_", "param", "\\u", "values_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module_", "=_", "self_", "._", "current", "\\u", "pipeline_", "._", "modules_", "[_", "m", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "FIX", "ME", " ", "remove", " ", "this", " ", "code", " ", "whe", "n", " ", "alias", "es", " ", "move_", "\\u\\u\\uNL\\u\\u\\u_", "old", "\\u", "id_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "old", "\\u", "function_", "in_", "module_", "._", "functions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "old", "\\u", "function_", "._", "name_", "==_", "function", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "old", "\\u", "id_", "=_", "old", "\\u", "function_", "._", "real", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ensure", " ", "tha", "t", " ", "replace", "ment", "s", " ", "don", "'", "t", " ", "happ", "en", " ", "for", " ", "function", "s", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shou", "ld", "n", "'", "t", " ", "be", " ", "replaced", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "aliases_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "old", "\\u", "id_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "function_", "=_", "module_", "._", "function", "\\u", "idx_", "[_", "old", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "param", "\\u", "values_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "aliases_", "._", "append_", "(_", "function_", "._", "params_", "[_", "i_", "]_", "._", "alias_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "op", "\\u", "list_", "._", "extend_", "(_", "self_", "._", "update", "\\u", "function", "\\u", "ops_", "(_", "module_", ",_", "function", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "param", "\\u", "values_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shou", "ld", "\\u", "replace_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "aliases_", "=_", "aliases_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "action_", "=_", "vist", "rail", "s_", "._", "core_", "._", "db_", "._", "action_", "._", "create", "\\u", "action_", "(_", "op", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "new", "\\u", "action_", "(_", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "current", "\\u", "pipeline_", "=_", "current", "\\u", "pipeline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "current", "\\u", "version_", "=_", "current", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "action_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
datamade/dedupe/dedupe/core.py
[ { "content": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\nfrom builtins import range, next, zip, map\nfrom future.utils import viewvalues, viewitems\nimport sys\nif sys.version < '3':\n text_type = unicode\n binary_type = str\nelse:\n text_type = str\n binary_type = bytes\n unicode = str\n\nimport itertools\nimport warnings\nimport numpy\nimport collections\nimport time\nimport tempfile\nimport os\nimport functools\nimport operator\n\nimport dedupe.backport as backport\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ChildProcessError(Exception) :\n pass", "metadata": "root.ChildProcessError", "header": "['module', '___EOS___']", "index": 25 }, { "content": "def randomPairsWithReplacement(n_records, sample_size) :\n # If the population is very large relative to the sample\n # size than we'll get very few duplicates by chance\n warnings.warn(\"There may be duplicates in the sample\")\n\n try :\n random_indices = numpy.random.randint(n_records, \n size=sample_size*2)\n except (OverflowError, ValueError):\n max_int = numpy.iinfo('int').max\n warnings.warn(\"Asked to sample pairs from %d records, will only sample pairs from first %d records\" % (n_records, max_int))\n random_indices = numpy.random.randint(max_int, \n size=sample_size*2)\n\n\n \n random_indices = random_indices.reshape((-1, 2))\n random_indices.sort(axis=1)\n\n return [(p.item(), q.item()) for p, q in random_indices]", "metadata": "root.randomPairsWithReplacement", "header": "['module', '___EOS___']", "index": 28 }, { "content": "def randomPairs(n_records, sample_size):\n \"\"\"\n Return random combinations of indices for a square matrix of size\n n records\n \"\"\"\n\n if n_records < 2 :\n raise ValueError(\"Needs at least two records\")\n n = n_records * (n_records - 1) / 2\n\n # numpy doesn't always throw an overflow error so we need to \n # check to make sure that the largest number we'll use is smaller\n # than the numpy's maximum unsigned integer\n if 8 * n > numpy.iinfo('uint').max :\n return randomPairsWithReplacement(n_records, sample_size)\n\n if sample_size >= n:\n if sample_size > n :\n warnings.warn(\"Requested sample of size %d, only returning %d possible pairs\" % (sample_size, n))\n\n random_indices = numpy.arange(n)\n else :\n random_indices = numpy.random.randint(int(n), size=sample_size)\n\n random_indices = random_indices.astype('uint')\n\n b = 1 - 2 * n_records\n\n x = numpy.trunc((-b - numpy.sqrt(b ** 2 - 8 * random_indices)) / 2)\n y = random_indices + x * (b + x + 2) / 2 + 1\n\n stacked = numpy.column_stack((x, y)).astype(int)\n\n return [(p.item(), q.item()) for p, q in stacked]", "metadata": "root.randomPairs", "header": "['module', '___EOS___']", "index": 50 }, { "content": "def randomPairsMatch(n_records_A, n_records_B, sample_size):\n \"\"\"\n Return random combinations of indices for record list A and B\n \"\"\"\n if not n_records_A or not n_records_B :\n raise ValueError(\"There must be at least one record in A and in B\")\n\n if sample_size >= n_records_A * n_records_B :\n\n if sample_size > n_records_A * n_records_B :\n warnings.warn(\"Requested sample of size %d, only returning %d possible pairs\" % (sample_size, n_records_A * n_records_B))\n\n return cartesian((numpy.arange(n_records_A),\n numpy.arange(n_records_B)))\n\n A_samples = numpy.random.randint(n_records_A, size=sample_size)\n B_samples = numpy.random.randint(n_records_B, size=sample_size)\n pairs = zip(A_samples,B_samples)\n set_pairs = set(pairs)\n\n while len(set_pairs) < sample_size:\n set_pairs.update(randomPairsMatch(n_records_A,\n n_records_B,\n (sample_size-len(set_pairs))))\n else:\n return set_pairs", "metadata": "root.randomPairsMatch", "header": "['module', '___EOS___']", "index": 85 }, { "content": "class ScoreRecords(object) :\n\n", "metadata": "root.ScoreRecords", "header": "['module', '___EOS___']", "index": 114 }, { "content": " def __init__(self, data_model, classifier, threshold) :\n self.data_model = data_model\n self.classifier = classifier\n self.threshold = threshold\n self.score_queue = None", "metadata": "root.ScoreRecords.__init__", "header": "['class', 'ScoreRecords', '(', 'object', ')', ':', '___EOS___']", "index": 115 }, { "content": " def __call__(self, records_queue, score_queue) :\n self.score_queue = score_queue\n while True :\n record_pairs = records_queue.get()\n if record_pairs is None :\n break\n\n try :\n filtered_pairs = self.fieldDistance(record_pairs)\n if filtered_pairs is not None :\n score_queue.put(filtered_pairs)\n except Exception as e :\n score_queue.put(e)\n raise\n\n score_queue.put(None)", "metadata": "root.ScoreRecords.__call__", "header": "['class', 'ScoreRecords', '(', 'object', ')', ':', '___EOS___']", "index": 121 }, { "content": " def fieldDistance(self, record_pairs) :\n ids = []\n records = []\n \n for record_pair in record_pairs :\n ((id_1, record_1, smaller_ids_1), \n (id_2, record_2, smaller_ids_2)) = record_pair\n\n if smaller_ids_1.isdisjoint(smaller_ids_2) :\n \n ids.append((id_1, id_2))\n records.append((record_1, record_2))\n\n if records :\n distances = self.data_model.distances(records)\n scores = self.classifier.predict_proba(distances)[:,-1]\n\n scored_pairs = numpy.rec.fromarrays((ids, scores),\n dtype= [('pairs', 'object', 2), \n ('score', 'f4', 1)])\n \n filtered_pairs = scored_pairs[scores > self.threshold]\n\n return filtered_pairs", "metadata": "root.ScoreRecords.fieldDistance", "header": "['class', 'ScoreRecords', '(', 'object', ')', ':', '___EOS___']", "index": 138 }, { "content": "def mergeScores(score_queue, result_queue, stop_signals) :\n scored_pairs = numpy.empty(0, dtype= [('pairs', 'object', 2), \n ('score', 'f4', 1)])\n\n seen_signals = 0\n while seen_signals < stop_signals :\n score_chunk = score_queue.get()\n if isinstance(score_chunk, Exception) :\n result_queue.put(score_chunk)\n return\n\n if score_chunk is not None :\n scored_pairs = numpy.concatenate((scored_pairs, score_chunk))\n else :\n seen_signals += 1\n\n if len(scored_pairs) :\n python_type = type(scored_pairs['pairs'][0][0])\n if python_type is binary_type or python_type is text_type :\n max_length = len(max(numpy.ravel(scored_pairs['pairs']), key=len))\n python_type = (unicode, max_length)\n \n write_dtype = [('pairs', python_type, 2),\n ('score', 'f4', 1)]\n\n scored_pairs = scored_pairs.astype(write_dtype)\n\n scored_pairs_file, file_path = tempfile.mkstemp()\n \n os.close(scored_pairs_file)\n\n fp = numpy.memmap(file_path, \n dtype=scored_pairs.dtype, \n shape=scored_pairs.shape)\n fp[:] = scored_pairs[:]\n\n result_queue.put((file_path, scored_pairs.dtype))\n\n else :\n result_queue.put(scored_pairs)", "metadata": "root.mergeScores", "header": "['module', '___EOS___']", "index": 163 }, { "content": "def scoreDuplicates(records, data_model, classifier, num_cores=1, threshold=0) :\n if num_cores < 2 :\n from multiprocessing.dummy import Process, Pool, Queue\n SimpleQueue = Queue\n else :\n from .backport import Process, Pool, SimpleQueue\n\n record_pairs_queue = SimpleQueue()\n score_queue = SimpleQueue()\n result_queue = SimpleQueue()\n\n n_map_processes = max(num_cores-1, 1)\n score_records = ScoreRecords(data_model, classifier, threshold) \n map_processes = [Process(target=score_records,\n args=(record_pairs_queue,\n score_queue))\n for _ in range(n_map_processes)]\n [process.start() for process in map_processes]\n\n reduce_process = Process(target=mergeScores,\n args=(score_queue,\n result_queue,\n n_map_processes))\n reduce_process.start()\n\n fillQueue(record_pairs_queue, records, n_map_processes)\n\n result = result_queue.get()\n if isinstance(result, Exception) :\n raise ChildProcessError\n\n if result :\n scored_pairs_file, dtype = result\n scored_pairs = numpy.memmap(scored_pairs_file,\n dtype=dtype)\n else :\n scored_pairs = result\n\n return scored_pairs", "metadata": "root.scoreDuplicates", "header": "['module', '___EOS___']", "index": 204 }, { "content": "def fillQueue(queue, iterable, stop_signals) :\n iterable = iter(iterable)\n chunk_size = 100000\n multiplier = 1.1\n\n # initial values\n i = 0\n n_records = 0\n t0 = time.clock()\n last_rate = 10000\n\n while True :\n chunk = list(itertools.islice(iterable, int(chunk_size)))\n if chunk :\n queue.put(chunk)\n\n n_records += chunk_size\n i += 1\n\n if i % 10 :\n time_delta = max(time.clock() - t0, 0.0001)\n\n current_rate = n_records/time_delta\n\n # chunk_size is always either growing or shrinking, if\n # the shrinking led to a faster rate, keep\n # shrinking. Same with growing. If the rate decreased,\n # reverse directions\n if current_rate < last_rate :\n multiplier = 1/multiplier\n\n chunk_size = max(chunk_size * multiplier, 1)\n\n last_rate = current_rate\n n_records = 0\n t0 = time.clock()\n \n\n else :\n # put poison pills in queue to tell scorers that they are\n # done\n [queue.put(None) for _ in range(stop_signals)]\n break", "metadata": "root.fillQueue", "header": "['module', '___EOS___']", "index": 246 }, { "content": "def peek(records) :\n try :\n record = next(records)\n except TypeError as e:\n if \"not an iterator\" not in str(e) :\n raise\n try :\n records = iter(records)\n record = next(records)\n except StopIteration :\n return None, records\n except StopIteration :\n return None, records\n \n\n\n return record, itertools.chain([record], records)", "metadata": "root.peek", "header": "['module', '___EOS___']", "index": 290 }, { "content": "def freezeData(data) : # pragma : no cover\n lfrozendict = frozendict\n return [(lfrozendict(record_1), \n lfrozendict(record_2))\n for record_1, record_2 in data]", "metadata": "root.freezeData", "header": "['module', '___EOS___']", "index": 309 }, { "content": "def isIndexed(data, offset) :\n return all(i in data for i in range(offset, offset + len(data)))", "metadata": "root.isIndexed", "header": "['module', '___EOS___']", "index": 315 }, { "content": "def index(data, offset=0) :\n if isIndexed(data, offset):\n return data\n else :\n data = dict(zip(itertools.count(offset), \n viewvalues(data)))\n return data", "metadata": "root.index", "header": "['module', '___EOS___']", "index": 318 }, { "content": "@functools.total_ordering\nclass frozendict(collections.Mapping):\n \"\"\"Don't forget the docstrings!!\"\"\"\n\n\n\n\n\n\n\n", "metadata": "root.frozendict", "header": "['module', '___EOS___']", "index": 326 }, { "content": " def __init__(self, arg): # pragma : no cover\n self._d = dict(arg)", "metadata": "root.frozendict.__init__", "header": "['class', 'frozendict', '(', 'collections', '.', 'Mapping', ')', ':', '___EOS___']", "index": 330 }, { "content": " def __iter__(self): # pragma : no cover\n return iter(self._d)", "metadata": "root.frozendict.__iter__", "header": "['class', 'frozendict', '(', 'collections', '.', 'Mapping', ')', ':', '___EOS___']", "index": 333 }, { "content": " def __len__(self): # pragma : no cover\n return len(self._d)", "metadata": "root.frozendict.__len__", "header": "['class', 'frozendict', '(', 'collections', '.', 'Mapping', ')', ':', '___EOS___']", "index": 336 }, { "content": " def __getitem__(self, key): # pragma : no cover\n return self._d[key]", "metadata": "root.frozendict.__getitem__", "header": "['class', 'frozendict', '(', 'collections', '.', 'Mapping', ')', ':', '___EOS___']", "index": 339 }, { "content": " def __repr__(self) :\n return u'<frozendict %s>' % repr(self._d)", "metadata": "root.frozendict.__repr__", "header": "['class', 'frozendict', '(', 'collections', '.', 'Mapping', ')', ':', '___EOS___']", "index": 342 }, { "content": " def __lt__(self, other) :\n return hash(self) < hash(other)", "metadata": "root.frozendict.__lt__", "header": "['class', 'frozendict', '(', 'collections', '.', 'Mapping', ')', ':', '___EOS___']", "index": 345 }, { "content": " def __eq__(self, other) :\n if hasattr(other, '_d') :\n return self._d == other._d\n else :\n return False", "metadata": "root.frozendict.__eq__", "header": "['class', 'frozendict', '(', 'collections', '.', 'Mapping', ')', ':', '___EOS___']", "index": 348 }, { "content": " def __hash__(self):\n try:\n return self._cached_hash\n except AttributeError:\n h = self._cached_hash = hash(frozenset(viewitems(self._d)))\n return h", "metadata": "root.frozendict.__hash__", "header": "['class', 'frozendict', '(', 'collections', '.', 'Mapping', ')', ':', '___EOS___']", "index": 354 }, { "content": "def cartesian(arrays, out=None): # pragma : no cover\n \"\"\"Generate a cartesian product of input arrays.\n\n Parameters\n ----------\n arrays : list of array-like\n 1-D arrays to form the cartesian product of.\n out : ndarray\n Array to place the cartesian product in.\n \n Returns\n -------\n out : ndarray\n 2-D array of shape (M, len(arrays)) containing cartesian products\n formed of input arrays.\n \n Examples\n --------\n >>> cartesian(([1, 2, 3], [4, 5], [6, 7]))\n array([[1, 4, 6],\n [1, 4, 7],\n [1, 5, 6],\n [1, 5, 7],\n [2, 4, 6],\n [2, 4, 7],\n [2, 5, 6],\n [2, 5, 7],\n [3, 4, 6],\n [3, 4, 7],\n [3, 5, 6],\n [3, 5, 7]])\n \n References\n ----------\n http://stackoverflow.com/q/1208118\n \n \"\"\"\n arrays = [numpy.asarray(x).ravel() for x in arrays]\n dtype = arrays[0].dtype\n\n n = numpy.prod([x.size for x in arrays])\n if out is None:\n out = numpy.empty([n, len(arrays)], dtype=dtype)\n\n m = n / arrays[0].size\n out[:, 0] = numpy.repeat(arrays[0], m)\n if arrays[1:]:\n cartesian(arrays[1:], out=out[0:m, 1:])\n for j in range(1, arrays[0].size):\n out[j * m:(j + 1) * m, 1:] = out[0:m, 1:]\n return out", "metadata": "root.cartesian", "header": "['module', '___EOS___']", "index": 362 }, { "content": "def iunzip(iterable, internal_length): # pragma : no cover\n \"\"\"Iunzip is the same as zip(*iter) but returns iterators, instead of \n expand the iterator. Mostly used for large sequence\"\"\"\n\n _tmp, iterable = itertools.tee(iterable, 2)\n iters = itertools.tee(iterable, internal_length)\n return (map(operator.itemgetter(i), it) for i, it in enumerate(iters))", "metadata": "root.iunzip", "header": "['module', '___EOS___']", "index": 414 } ]
[ { "span": "import dedupe.backport as backport", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 34 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "builtins_", "import_", "range_", ",_", "next_", ",_", "zip_", ",_", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "future_", "._", "utils_", "import_", "view", "values_", ",_", "view", "items_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sys_", "._", "version_", "<_", "'", "3", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text", "\\u", "type_", "=_", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "binar", "y", "\\u", "type_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text", "\\u", "type_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "binar", "y", "\\u", "type_", "=_", "bytes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unicode_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "itertools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "functools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "operator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "dedup", "e_", "._", "backp", "ort_", "as_", "backp", "ort_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Chil", "d", "Process", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "random", "Pair", "s", "With", "Replace", "ment_", "(_", "n", "\\u", "records_", ",_", "sample", "\\u", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "popul", "ation", " ", "is", " ", "very", " ", "large", " ", "relative", " ", "to", " ", "the", " ", "sample_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "size", " ", "than", " ", "we", "'", "ll", " ", "get", " ", "very", " ", "few", " ", "duplicat", "es", " ", "by", " ", "chance_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "\"", "There", " ", "may", " ", "be", " ", "duplicat", "es", " ", "in", " ", "the", " ", "sample", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "random", "\\u", "indices_", "=_", "numpy_", "._", "random_", "._", "randint_", "(_", "n", "\\u", "records_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "size_", "=_", "sample", "\\u", "size_", "*_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Over", "flow", "Error_", ",_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "\\u", "int_", "=_", "numpy_", "._", "ii", "nfo_", "(_", "'", "int", "'_", ")_", "._", "max_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "._", "warn_", "(_", "\"", "As", "ked", " ", "to", " ", "sample", " ", "pair", "s", " ", "from", " ", "%", "d", " ", "record", "s", ",", " ", "will", " ", "only", " ", "sample", " ", "pair", "s", " ", "from", " ", "first", " ", "%", "d", " ", "record", "s", "\"_", "%_", "(_", "n", "\\u", "records_", ",_", "max", "\\u", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "random", "\\u", "indices_", "=_", "numpy_", "._", "random_", "._", "randint_", "(_", "max", "\\u", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "size_", "=_", "sample", "\\u", "size_", "*_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "random", "\\u", "indices_", "=_", "random", "\\u", "indices_", "._", "reshape_", "(_", "(_", "-_", "1_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "random", "\\u", "indices_", "._", "sort_", "(_", "axis_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "[_", "(_", "p_", "._", "item_", "(_", ")_", ",_", "q_", "._", "item_", "(_", ")_", ")_", "for_", "p_", ",_", "q_", "in_", "random", "\\u", "indices_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "random", "Pairs_", "(_", "n", "\\u", "records_", ",_", "sample", "\\u", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "random", " ", "combinat", "ion", "s", " ", "of", " ", "indice", "s", " ", "for", " ", "a", " ", "square", " ", "matrix", " ", "of", " ", "size", "\\", "10", ";", " ", " ", " ", " ", "n", " ", "record", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "n", "\\u", "records_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Ne", "eds", " ", "at", " ", "leas", "t", " ", "two", " ", "record", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "n_", "=_", "n", "\\u", "records_", "*_", "(_", "n", "\\u", "records_", "-_", "1_", ")_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "nump", "y", " ", "doe", "sn", "'", "t", " ", "alw", "ay", "s", " ", "throw", " ", "an", " ", "overflow", " ", "error", " ", "so", " ", "we", " ", "need", " ", "to", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "to", " ", "make", " ", "sure", " ", "tha", "t", " ", "the", " ", "large", "st", " ", "number", " ", "we", "'", "ll", " ", "use", " ", "is", " ", "small", "er_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "than", " ", "the", " ", "nump", "y", "'", "s", " ", "maxim", "um", " ", "unsigned", " ", "integer_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "8_", "*_", "n_", ">_", "numpy_", "._", "ii", "nfo_", "(_", "'", "uint", "'_", ")_", "._", "max_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "random", "Pair", "s", "With", "Replace", "ment_", "(_", "n", "\\u", "records_", ",_", "sample", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sample", "\\u", "size_", ">=_", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sample", "\\u", "size_", ">_", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "\"", "Requeste", "d", " ", "sample", " ", "of", " ", "size", " ", "%", "d", ",", " ", "only", " ", "return", "ing", " ", "%", "d", " ", "possib", "le", " ", "pair", "s", "\"_", "%_", "(_", "sample", "\\u", "size_", ",_", "n_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "random", "\\u", "indices_", "=_", "numpy_", "._", "arange_", "(_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "random", "\\u", "indices_", "=_", "numpy_", "._", "random_", "._", "randint_", "(_", "int_", "(_", "n_", ")_", ",_", "size_", "=_", "sample", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "random", "\\u", "indices_", "=_", "random", "\\u", "indices_", "._", "astype_", "(_", "'", "uint", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "b_", "=_", "1_", "-_", "2_", "*_", "n", "\\u", "records_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "numpy_", "._", "trunc", "_", "(_", "(_", "-_", "b_", "-_", "numpy_", "._", "sqrt_", "(_", "b_", "**_", "2_", "-_", "8_", "*_", "random", "\\u", "indices_", ")_", ")_", "/_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "random", "\\u", "indices_", "+_", "x_", "*_", "(_", "b_", "+_", "x_", "+_", "2_", ")_", "/_", "2_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stacked", "_", "=_", "numpy_", "._", "column", "\\u", "stack_", "(_", "(_", "x_", ",_", "y_", ")_", ")_", "._", "astype_", "(_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "[_", "(_", "p_", "._", "item_", "(_", ")_", ",_", "q_", "._", "item_", "(_", ")_", ")_", "for_", "p_", ",_", "q_", "in_", "stacked", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "random", "Pair", "s", "Match_", "(_", "n", "\\u", "record", "s", "\\u", "A_", ",_", "n", "\\u", "record", "s", "\\u", "B_", ",_", "sample", "\\u", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "random", " ", "combinat", "ion", "s", " ", "of", " ", "indice", "s", " ", "for", " ", "record", " ", "list", " ", "A", " ", "and", " ", "B", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "n", "\\u", "record", "s", "\\u", "A_", "or_", "not_", "n", "\\u", "record", "s", "\\u", "B_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "There", " ", "must", " ", "be", " ", "at", " ", "leas", "t", " ", "one", " ", "record", " ", "in", " ", "A", " ", "and", " ", "in", " ", "B", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sample", "\\u", "size_", ">=_", "n", "\\u", "record", "s", "\\u", "A_", "*_", "n", "\\u", "record", "s", "\\u", "B_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sample", "\\u", "size_", ">_", "n", "\\u", "record", "s", "\\u", "A_", "*_", "n", "\\u", "record", "s", "\\u", "B_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "\"", "Requeste", "d", " ", "sample", " ", "of", " ", "size", " ", "%", "d", ",", " ", "only", " ", "return", "ing", " ", "%", "d", " ", "possib", "le", " ", "pair", "s", "\"_", "%_", "(_", "sample", "\\u", "size_", ",_", "n", "\\u", "record", "s", "\\u", "A_", "*_", "n", "\\u", "record", "s", "\\u", "B_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cartesian", "_", "(_", "(_", "numpy_", "._", "arange_", "(_", "n", "\\u", "record", "s", "\\u", "A_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "numpy_", "._", "arange_", "(_", "n", "\\u", "record", "s", "\\u", "B_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "A", "\\u", "samples_", "=_", "numpy_", "._", "random_", "._", "randint_", "(_", "n", "\\u", "record", "s", "\\u", "A_", ",_", "size_", "=_", "sample", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "B", "\\u", "samples_", "=_", "numpy_", "._", "random_", "._", "randint_", "(_", "n", "\\u", "record", "s", "\\u", "B_", ",_", "size_", "=_", "sample", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pairs_", "=_", "zip_", "(_", "A", "\\u", "samples_", ",_", "B", "\\u", "samples_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "pairs_", "=_", "set_", "(_", "pairs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "len_", "(_", "set\\u", "pairs_", ")_", "<_", "sample", "\\u", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set\\u", "pairs_", "._", "update_", "(_", "random", "Pair", "s", "Match_", "(_", "n", "\\u", "record", "s", "\\u", "A_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "record", "s", "\\u", "B_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "sample", "\\u", "size_", "-_", "len_", "(_", "set\\u", "pairs_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "set\\u", "pairs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Score", "Records_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Score", "Records_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "data\\u", "model_", ",_", "classifier_", ",_", "threshold_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "data\\u", "model_", "=_", "data\\u", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "classifier_", "=_", "classifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "threshold_", "=_", "threshold_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "score", "\\u", "queue_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Score", "Records_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "call\\u\\u_", "(_", "self_", ",_", "record", "s", "\\u", "queue_", ",_", "score", "\\u", "queue_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "score", "\\u", "queue_", "=_", "score", "\\u", "queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "record", "\\u", "pairs_", "=_", "record", "s", "\\u", "queue_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "record", "\\u", "pairs_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filter", "ed", "\\u", "pairs_", "=_", "self_", "._", "field", "Distance_", "(_", "record", "\\u", "pairs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "filter", "ed", "\\u", "pairs_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "score", "\\u", "queue_", "._", "put_", "(_", "filter", "ed", "\\u", "pairs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "score", "\\u", "queue_", "._", "put_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "score", "\\u", "queue_", "._", "put_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Score", "Records_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "field", "Distance_", "(_", "self_", ",_", "record", "\\u", "pairs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ids_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "records_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "record", "\\u", "pair_", "in_", "record", "\\u", "pairs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "(_", "id", "\\u", "1_", ",_", "record", "\\u", "1_", ",_", "small", "er", "\\u", "ids", "\\u", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "id", "\\u", "2_", ",_", "record", "\\u", "2_", ",_", "small", "er", "\\u", "ids", "\\u", "2_", ")_", ")_", "=_", "record", "\\u", "pair_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "small", "er", "\\u", "ids", "\\u", "1_", "._", "isdi", "sj", "oint_", "(_", "small", "er", "\\u", "ids", "\\u", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ids_", "._", "append_", "(_", "(_", "id", "\\u", "1_", ",_", "id", "\\u", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "records_", "._", "append_", "(_", "(_", "record", "\\u", "1_", ",_", "record", "\\u", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "records_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "distances_", "=_", "self_", "._", "data\\u", "model_", "._", "distances_", "(_", "records_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scores_", "=_", "self_", "._", "classifier_", "._", "predi", "ct", "\\u", "proba_", "(_", "distances_", ")_", "[_", ":_", ",_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scored", "\\u", "pairs_", "=_", "numpy_", "._", "rec_", "._", "froma", "rray", "s_", "(_", "(_", "ids_", ",_", "scores_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dtype_", "=_", "[_", "(_", "'", "pair", "s", "'_", ",_", "'", "object", "'_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "score", "'_", ",_", "'", "f4", "'_", ",_", "1_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "filter", "ed", "\\u", "pairs_", "=_", "scored", "\\u", "pairs_", "[_", "scores_", ">_", "self_", "._", "threshold_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "filter", "ed", "\\u", "pairs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "merge", "Scores_", "(_", "score", "\\u", "queue_", ",_", "result", "\\u", "queue_", ",_", "stop", "\\u", "signals_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scored", "\\u", "pairs_", "=_", "numpy_", "._", "empty_", "(_", "0_", ",_", "dtype_", "=_", "[_", "(_", "'", "pair", "s", "'_", ",_", "'", "object", "'_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "score", "'_", ",_", "'", "f4", "'_", ",_", "1_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "see", "n", "\\u", "signals_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "see", "n", "\\u", "signals_", "<_", "stop", "\\u", "signals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "score", "\\u", "chunk_", "=_", "score", "\\u", "queue_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "score", "\\u", "chunk_", ",_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result", "\\u", "queue_", "._", "put_", "(_", "score", "\\u", "chunk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "score", "\\u", "chunk_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scored", "\\u", "pairs_", "=_", "numpy_", "._", "concatenate_", "(_", "(_", "scored", "\\u", "pairs_", ",_", "score", "\\u", "chunk_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "see", "n", "\\u", "signals_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "scored", "\\u", "pairs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "python", "\\u", "type_", "=_", "type_", "(_", "scored", "\\u", "pairs_", "[_", "'", "pair", "s", "'_", "]_", "[_", "0_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "python", "\\u", "type_", "is_", "binar", "y", "\\u", "type_", "or_", "python", "\\u", "type_", "is_", "text", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "\\u", "length_", "=_", "len_", "(_", "max_", "(_", "numpy_", "._", "ravel_", "(_", "scored", "\\u", "pairs_", "[_", "'", "pair", "s", "'_", "]_", ")_", ",_", "key_", "=_", "len_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "python", "\\u", "type_", "=_", "(_", "unicode_", ",_", "max", "\\u", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "write", "\\u", "dtype_", "=_", "[_", "(_", "'", "pair", "s", "'_", ",_", "python", "\\u", "type_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "score", "'_", ",_", "'", "f4", "'_", ",_", "1_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scored", "\\u", "pairs_", "=_", "scored", "\\u", "pairs_", "._", "astype_", "(_", "write", "\\u", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scored", "\\u", "pair", "s", "\\u", "file_", ",_", "file", "\\u", "path_", "=_", "tempfile_", "._", "mkstemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "close_", "(_", "scored", "\\u", "pair", "s", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fp_", "=_", "numpy_", "._", "mem", "map_", "(_", "file", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dtype_", "=_", "scored", "\\u", "pairs_", "._", "dtype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "scored", "\\u", "pairs_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp_", "[_", ":_", "]_", "=_", "scored", "\\u", "pairs_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result", "\\u", "queue_", "._", "put_", "(_", "(_", "file", "\\u", "path_", ",_", "scored", "\\u", "pairs_", "._", "dtype_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result", "\\u", "queue_", "._", "put_", "(_", "scored", "\\u", "pairs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "score", "Duplicate", "s_", "(_", "records_", ",_", "data\\u", "model_", ",_", "classifier_", ",_", "num", "\\u", "cores_", "=_", "1_", ",_", "threshold_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "num", "\\u", "cores_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "multiprocessing_", "._", "dummy_", "import_", "Process_", ",_", "Pool_", ",_", "Queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Simple", "Queue_", "=_", "Queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "._", "backp", "ort_", "import_", "Process_", ",_", "Pool_", ",_", "Simple", "Queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "record", "\\u", "pair", "s", "\\u", "queue_", "=_", "Simple", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "score", "\\u", "queue_", "=_", "Simple", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "queue_", "=_", "Simple", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "map", "\\u", "processes_", "=_", "max_", "(_", "num", "\\u", "cores_", "-_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "score", "\\u", "records_", "=_", "Score", "Records_", "(_", "data\\u", "model_", ",_", "classifier_", ",_", "threshold_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map", "\\u", "processes_", "=_", "[_", "Process_", "(_", "target_", "=_", "score", "\\u", "records_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "(_", "record", "\\u", "pair", "s", "\\u", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "score", "\\u", "queue_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "\\u_", "in_", "range_", "(_", "n", "\\u", "map", "\\u", "processes_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[_", "process_", "._", "start_", "(_", ")_", "for_", "process_", "in_", "map", "\\u", "processes_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reduce", "\\u", "process_", "=_", "Process_", "(_", "target_", "=_", "merge", "Scores_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "(_", "score", "\\u", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "result", "\\u", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "map", "\\u", "processes_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reduce", "\\u", "process_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fill", "Queue_", "(_", "record", "\\u", "pair", "s", "\\u", "queue_", ",_", "records_", ",_", "n", "\\u", "map", "\\u", "processes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "result", "\\u", "queue_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "result_", ",_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Chil", "d", "Process", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scored", "\\u", "pair", "s", "\\u", "file_", ",_", "dtype_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scored", "\\u", "pairs_", "=_", "numpy_", "._", "mem", "map_", "(_", "scored", "\\u", "pair", "s", "\\u", "file_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dtype_", "=_", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scored", "\\u", "pairs_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "scored", "\\u", "pairs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fill", "Queue_", "(_", "queue_", ",_", "iterable_", ",_", "stop", "\\u", "signals_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iterable_", "=_", "iter_", "(_", "iterable_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chunk", "\\u", "size_", "=_", "100000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "multiplier_", "=_", "1.1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "initial", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "records_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t0_", "=_", "time_", "._", "clock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "rate_", "=_", "10000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chunk_", "=_", "list_", "(_", "itertools_", "._", "islice_", "(_", "iterable_", ",_", "int_", "(_", "chunk", "\\u", "size_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "chunk_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "queue_", "._", "put_", "(_", "chunk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "records_", "+=_", "chunk", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "i_", "%_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time", "\\u", "delta_", "=_", "max_", "(_", "time_", "._", "clock_", "(_", ")_", "-_", "t0_", ",_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "rate_", "=_", "n", "\\u", "records_", "/_", "time", "\\u", "delta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "chunk", "\\u", "size", " ", "is", " ", "alw", "ay", "s", " ", "eit", "her", " ", "grow", "ing", " ", "or", " ", "shrink", "ing", ",", " ", "if_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "shrink", "ing", " ", "led", " ", "to", " ", "a", " ", "faste", "r", " ", "rate", ",", " ", "keep_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shrink", "ing", ".", " ", "Sam", "e", " ", "with", " ", "grow", "ing", ".", " ", "If", " ", "the", " ", "rate", " ", "decrease", "d", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reverse", " ", "directions_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "current", "\\u", "rate_", "<_", "last", "\\u", "rate_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "multiplier_", "=_", "1_", "/_", "multiplier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "chunk", "\\u", "size_", "=_", "max_", "(_", "chunk", "\\u", "size_", "*_", "multiplier_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "last", "\\u", "rate_", "=_", "current", "\\u", "rate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "records_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t0_", "=_", "time_", "._", "clock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "put", " ", "pois", "on", " ", "pill", "s", " ", "in", " ", "queue", " ", "to", " ", "tell", " ", "scorer", "s", " ", "tha", "t", " ", "the", "y", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "done_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "[_", "queue_", "._", "put_", "(_", "None_", ")_", "for_", "\\u_", "in_", "range_", "(_", "stop", "\\u", "signals_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "peek_", "(_", "records_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "record_", "=_", "next_", "(_", "records_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"", "not", " ", "an", " ", "iter", "ator", "\"_", "not_", "in_", "str_", "(_", "e_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "records_", "=_", "iter_", "(_", "records_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "record_", "=_", "next_", "(_", "records_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sto", "p", "Iteration_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", ",_", "records_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sto", "p", "Iteration_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", ",_", "records_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "record_", ",_", "itertools_", "._", "chain_", "(_", "[_", "record_", "]_", ",_", "records_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "freez", "e", "Data_", "(_", "data_", ")_", ":_", "#", " ", "pragma", " ", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lf", "ro", "zen", "dict_", "=_", "frozen", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "(_", "lf", "ro", "zen", "dict_", "(_", "record", "\\u", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lf", "ro", "zen", "dict_", "(_", "record", "\\u", "2_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "record", "\\u", "1_", ",_", "record", "\\u", "2_", "in_", "data_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "Indexe", "d_", "(_", "data_", ",_", "offset_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "all_", "(_", "i_", "in_", "data_", "for_", "i_", "in_", "range_", "(_", "offset_", ",_", "offset_", "+_", "len_", "(_", "data_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "index_", "(_", "data_", ",_", "offset_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "Indexe", "d_", "(_", "data_", ",_", "offset_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "dict_", "(_", "zip_", "(_", "itertools_", "._", "count_", "(_", "offset_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "view", "values_", "(_", "data_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "functools_", "._", "total", "\\u", "ordering_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "frozen", "dict_", "(_", "collections_", "._", "Mapping_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Don", "'", "t", " ", "forget", " ", "the", " ", "docstrings", "!!\"", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "frozen", "dict_", "(_", "collections_", "._", "Mapping_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "arg_", ")_", ":_", "#", " ", "pragma", " ", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "d_", "=_", "dict_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "frozen", "dict_", "(_", "collections_", "._", "Mapping_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "#", " ", "pragma", " ", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "iter_", "(_", "self_", "._", "\\u", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "frozen", "dict_", "(_", "collections_", "._", "Mapping_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "len\\u\\u_", "(_", "self_", ")_", ":_", "#", " ", "pragma", " ", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "self_", "._", "\\u", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "frozen", "dict_", "(_", "collections_", "._", "Mapping_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "#", " ", "pragma", " ", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "d_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "frozen", "dict_", "(_", "collections_", "._", "Mapping_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "u", "'<", "frozen", "dict", " ", "%", "s", ">'_", "%_", "repr_", "(_", "self_", "._", "\\u", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "frozen", "dict_", "(_", "collections_", "._", "Mapping_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "lt\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "hash_", "(_", "self_", ")_", "<_", "hash_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "frozen", "dict_", "(_", "collections_", "._", "Mapping_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "other_", ",_", "'\\u", "d", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "d_", "==_", "other_", "._", "\\u", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "frozen", "dict_", "(_", "collections_", "._", "Mapping_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "hash\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "cache", "d\\u", "hash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "h_", "=_", "self_", "._", "\\u", "cache", "d\\u", "hash_", "=_", "hash_", "(_", "frozenset_", "(_", "view", "items_", "(_", "self_", "._", "\\u", "d_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cartesian", "_", "(_", "arrays_", ",_", "out_", "=_", "None_", ")_", ":_", "#", " ", "pragma", " ", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Generate", " ", "a", " ", "cartesian", " ", "product", " ", "of", " ", "input", " ", "arrays", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "arrays", " ", ":", " ", "list", " ", "of", " ", "array", "-", "like", "\\", "10", ";", " ", " ", " ", " ", "1", "-", "D", " ", "arrays", " ", "to", " ", "form", " ", "the", " ", "cartesian", " ", "product", " ", "of", ".", "\\", "10", ";", " ", " ", " ", " ", "out", " ", ":", " ", "ndar", "ray", "\\", "10", ";", " ", " ", " ", " ", "Array", " ", "to", " ", "place", " ", "the", " ", "cartesian", " ", "product", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "out", " ", ":", " ", "ndar", "ray", "\\", "10", ";", " ", " ", " ", " ", "2", "-", "D", " ", "array", " ", "of", " ", "shape", " ", "(", "M", ",", " ", "len", "(", "arrays", "))", " ", "contain", "ing", " ", "cartesian", " ", "products", "\\", "10", ";", " ", " ", " ", " ", "formed", " ", "of", " ", "input", " ", "arrays", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "--------", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "cartesian", "(([", "1", ",", " ", "2", ",", " ", "3", "],", " ", "[", "4", ",", " ", "5", "],", " ", "[", "6", ",", " ", "7", "]))", "\\", "10", ";", " ", " ", " ", " ", "array", "([", "[", "1", ",", " ", "4", ",", " ", "6", "],", "\\", "10", ";", " ", " ", " ", " ", "[", "1", ",", " ", "4", ",", " ", "7", "],", "\\", "10", ";", " ", " ", " ", " ", "[", "1", ",", " ", "5", ",", " ", "6", "],", "\\", "10", ";", " ", " ", " ", " ", "[", "1", ",", " ", "5", ",", " ", "7", "],", "\\", "10", ";", " ", " ", " ", " ", "[", "2", ",", " ", "4", ",", " ", "6", "],", "\\", "10", ";", " ", " ", " ", " ", "[", "2", ",", " ", "4", ",", " ", "7", "],", "\\", "10", ";", " ", " ", " ", " ", "[", "2", ",", " ", "5", ",", " ", "6", "],", "\\", "10", ";", " ", " ", " ", " ", "[", "2", ",", " ", "5", ",", " ", "7", "],", "\\", "10", ";", " ", " ", " ", " ", "[", "3", ",", " ", "4", ",", " ", "6", "],", "\\", "10", ";", " ", " ", " ", " ", "[", "3", ",", " ", "4", ",", " ", "7", "],", "\\", "10", ";", " ", " ", " ", " ", "[", "3", ",", " ", "5", ",", " ", "6", "],", "\\", "10", ";", " ", " ", " ", " ", "[", "3", ",", " ", "5", ",", " ", "7", "]])", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Reference", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "http", "://", "stack", "overflow", ".", "com", "/", "q", "/", "120", "811", "8", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arrays_", "=_", "[_", "numpy_", "._", "asarray_", "(_", "x_", ")_", "._", "ravel_", "(_", ")_", "for_", "x_", "in_", "arrays_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dtype_", "=_", "arrays_", "[_", "0_", "]_", "._", "dtype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n_", "=_", "numpy_", "._", "prod_", "(_", "[_", "x_", "._", "size_", "for_", "x_", "in_", "arrays_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "out_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "=_", "numpy_", "._", "empty_", "(_", "[_", "n_", ",_", "len_", "(_", "arrays_", ")_", "]_", ",_", "dtype_", "=_", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "m_", "=_", "n_", "/_", "arrays_", "[_", "0_", "]_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "[_", ":_", ",_", "0_", "]_", "=_", "numpy_", "._", "repeat_", "(_", "arrays_", "[_", "0_", "]_", ",_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "arrays_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cartesian", "_", "(_", "arrays_", "[_", "1_", ":_", "]_", ",_", "out_", "=_", "out_", "[_", "0_", ":_", "m_", ",_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", "in_", "range_", "(_", "1_", ",_", "arrays_", "[_", "0_", "]_", "._", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "[_", "j_", "*_", "m_", ":_", "(_", "j_", "+_", "1_", ")_", "*_", "m_", ",_", "1_", ":_", "]_", "=_", "out_", "[_", "0_", ":_", "m_", ",_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "out_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "iu", "nz", "ip_", "(_", "iterable_", ",_", "internal", "\\u", "length_", ")_", ":_", "#", " ", "pragma", " ", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Iu", "nz", "ip", " ", "is", " ", "the", " ", "same", " ", "as", " ", "zip", "(*", "iter", ")", " ", "but", " ", "return", "s", " ", "iterators", ",", " ", "inst", "ead", " ", "of", " ", "\\", "10", ";", " ", " ", " ", " ", "expand", " ", "the", " ", "iter", "ator", ".", " ", "Mos", "tl", "y", " ", "used", " ", "for", " ", "large", " ", "sequence", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tmp_", ",_", "iterable_", "=_", "itertools_", "._", "tee", "_", "(_", "iterable_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iters_", "=_", "itertools_", "._", "tee", "_", "(_", "iterable_", ",_", "internal", "\\u", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "map_", "(_", "operator_", "._", "itemgetter_", "(_", "i_", ")_", ",_", "it_", ")_", "for_", "i_", ",_", "it_", "in_", "enumerate_", "(_", "iters_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
`__init__` method calls overridden method
GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/datastore/datastore_pbs.py
[ { "content": "class IdResolver(object):\n \"\"\"A class that can handle project id <--> application id transformations.\"\"\"\n\n\n", "metadata": "root.IdResolver", "header": "['module', '___EOS___']", "index": 276 }, { "content": " def __init__(self, app_ids=()):\n \"\"\"Create a new IdResolver.\n\n Args:\n app_ids: A list of application ids with application id shard set. i.e.\n s~my_app or e~my_app.\n \"\"\"\n resolver_map = {}\n for app_id in app_ids:\n resolver_map[self.resolve_project_id(app_id)] = app_id\n self._resolver_map = resolver_map", "metadata": "root.IdResolver.__init__", "header": "['class', 'IdResolver', '(', 'object', ')', ':', '___EOS___']", "index": 279 }, { "content": " def resolve_project_id(self, app_id):\n \"\"\"Converts an application id to a project id.\n\n Args:\n app_id: The application id.\n Returns:\n The project id.\n \"\"\"\n return app_id.rsplit('~')[-1]", "metadata": "root.IdResolver.resolve_project_id", "header": "['class', 'IdResolver', '(', 'object', ')', ':', '___EOS___']", "index": 291 }, { "content": " def resolve_app_id(self, project_id):\n \"\"\"Converts a project id to an application id.\n\n Args:\n project_id: The project id.\n Returns:\n The application id.\n Raises:\n InvalidConversionError: if the application is unknown for the project id.\n \"\"\"\n check_conversion(project_id in self._resolver_map,\n 'Cannot determine application id for provided project id: '\n '\"%s\".'\n % project_id)\n return self._resolver_map[project_id]", "metadata": "root.IdResolver.resolve_app_id", "header": "['class', 'IdResolver', '(', 'object', ')', ':', '___EOS___']", "index": 301 }, { "content": "class _IdentityIdResolver(IdResolver):\n \"\"\"An IdResolver that resolve app_id == project_id.\"\"\"\n\n", "metadata": "root._IdentityIdResolver", "header": "['module', '___EOS___']", "index": 318 }, { "content": " def resolve_project_id(self, app_id):\n return app_id", "metadata": "root._IdentityIdResolver.resolve_project_id", "header": "['class', '_IdentityIdResolver', '(', 'IdResolver', ')', ':', '___EOS___']", "index": 321 }, { "content": " def resolve_app_id(self, project_id):\n return project_id", "metadata": "root._IdentityIdResolver.resolve_app_id", "header": "['class', '_IdentityIdResolver', '(', 'IdResolver', ')', ':', '___EOS___']", "index": 324 } ]
[ { "span": "self.resolve_project_id(app_id)]", "start_line": 288, "start_column": 19, "end_line": 288, "end_column": 50 } ]
[ { "span": "def resolve_project_id(self, app_id):", "start_line": 291, "start_column": 2, "end_line": 291, "end_column": 39 }, { "span": "def resolve_project_id(self, app_id):", "start_line": 321, "start_column": 2, "end_line": 321, "end_column": 39 } ]
1
false
[ "[CLS]_", "`_", "\\u\\u", "init\\u\\u_", "`_", "method_", "calls_", "overrid", "den_", "method_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Id", "Resolver_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "class", " ", "tha", "t", " ", "can", " ", "handle", " ", "project", " ", "id", " ", "<-", "->", " ", "applica", "tion", " ", "id", " ", "transformation", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Id", "Resolver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "app", "\\u", "ids_", "=_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "new", " ", "Id", "Resolv", "er", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", "app", "\\u", "ids", ":", " ", "A", " ", "list", " ", "of", " ", "applica", "tion", " ", "ids", " ", "with", " ", "applica", "tion", " ", "id", " ", "shard", " ", "set", ".", " ", "i", ".", "e", ".", "\\", "10", ";", " ", " ", " ", " ", " ", "s", "~", "my", "\\u", "app", " ", "or", " ", "e", "~", "my", "\\u", "app", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resolver", "\\u", "map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "app", "\\u", "id_", "in_", "app", "\\u", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resolver", "\\u", "map_", "[_", "self_", "._", "resolve", "\\u", "project", "\\u", "id_", "(_", "app", "\\u", "id_", ")_", "]_", "=_", "app", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "resolver", "\\u", "map_", "=_", "resolver", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Id", "Resolver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "resolve", "\\u", "project", "\\u", "id_", "(_", "self_", ",_", "app", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", "s", " ", "an", " ", "applica", "tion", " ", "id", " ", "to", " ", "a", " ", "project", " ", "id", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "app", "\\u", "id", ":", " ", "The", " ", "applica", "tion", " ", "id", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "The", " ", "project", " ", "id", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "app", "\\u", "id_", "._", "rsplit_", "(_", "'~'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Id", "Resolver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "resolve", "\\u", "app", "\\u", "id_", "(_", "self_", ",_", "project", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", "s", " ", "a", " ", "project", " ", "id", " ", "to", " ", "an", " ", "applica", "tion", " ", "id", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "project", "\\u", "id", ":", " ", "The", " ", "project", " ", "id", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "The", " ", "applica", "tion", " ", "id", ".", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", "Inva", "lid", "Conversion", "Error", ":", " ", "if", " ", "the", " ", "applica", "tion", " ", "is", " ", "unknown", " ", "for", " ", "the", " ", "project", " ", "id", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "\\u", "conversion_", "(_", "project", "\\u", "id_", "in_", "self_", "._", "\\u", "resolver", "\\u", "map_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Cann", "ot", " ", "dete", "rmin", "e", " ", "applica", "tion", " ", "id", " ", "for", " ", "provided", " ", "project", " ", "id", ":", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'\"", "%", "s", "\".'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "project", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "resolver", "\\u", "map_", "[_", "project", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "\\u", "Ident", "it", "y", "Id", "Resolver_", "(_", "Id", "Resolver_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "An", " ", "Id", "Resolv", "er", " ", "tha", "t", " ", "resolve", " ", "app", "\\u", "id", " ", "==", " ", "project", "\\u", "id", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Ident", "it", "y", "Id", "Resolver_", "(_", "Id", "Resolver_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "resolve", "\\u", "project", "\\u", "id_", "(_", "self_", ",_", "app", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "app", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Ident", "it", "y", "Id", "Resolver_", "(_", "Id", "Resolver_", ")_", ":_", "\\u\\u\\uEOS\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4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
nkuttler/flaskwallet/otpapp/views.py
[ { "content": "import urllib\nfrom StringIO import StringIO\nfrom base64 import b32encode\n\nfrom flask import abort\nfrom flask import flash\nfrom flask import make_response\nfrom flask import render_template\nfrom flask import redirect\nfrom flask import request\nfrom flask import send_file\nfrom flask import url_for\nfrom flask.views import View\n\nfrom flaskwallet import session\nfrom settingsapp.models import Setting\n\nimport qrcode\nfrom Crypto.Random import get_random_bytes\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class OTPSetupView(View):", "metadata": "root.OTPSetupView", "header": "['module', '___EOS___']", "index": 21 }, { "content": " def dispatch_request(self):\n return render_template('otp/setup.html')", "metadata": "root.OTPSetupView.dispatch_request", "header": "['class', 'OTPSetupView', '(', 'View', ')', ':', '___EOS___']", "index": 22 }, { "content": "class QRView(View):\n \"\"\"\n http://www.brool.com/index.php/using-google-authenticator-for-your-website\n \"\"\"\n\n\n\n", "metadata": "root.QRView", "header": "['module', '___EOS___']", "index": 26 }, { "content": " def dispatch_request(self):\n secret = self.get_secret()\n if secret:\n return send_file(self.get_qr(secret), mimetype='image/png')\n else:\n abort(404)", "metadata": "root.QRView.dispatch_request", "header": "['class', 'QRView', '(', 'View', ')', ':', '___EOS___']", "index": 30 }, { "content": " def get_secret(self):\n \"\"\"\n Cryptographically-secure 10 byte random key, presented to the user as\n a base32 16-character string.\n \"\"\"\n name = 'otpsecret'\n setting = session.query(Setting).get(name)\n if setting:\n ret = False\n else:\n secret = get_random_bytes(10)\n code = b32encode(secret)\n setting = Setting(name, code)\n session.add(setting)\n session.commit()\n ret = code\n return ret", "metadata": "root.QRView.get_secret", "header": "['class', 'QRView', '(', 'View', ')', ':', '___EOS___']", "index": 37 }, { "content": " def get_qr(self, secret):\n img_io = StringIO()\n qr = self.build_qr_image(secret)\n qr.save(img_io, 'PNG')\n img_io.seek(0)\n return img_io", "metadata": "root.QRView.get_qr", "header": "['class', 'QRView', '(', 'View', ')', ':', '___EOS___']", "index": 55 }, { "content": " def build_qr_image(self, secret):\n qr = qrcode.QRCode(\n version=1,\n error_correction=qrcode.constants.ERROR_CORRECT_L,\n box_size=10,\n border=4,\n )\n qr.add_data(self.get_authenticator_url(secret))\n qr.make(fit=True)\n return qr.make_image()", "metadata": "root.QRView.build_qr_image", "header": "['class', 'QRView', '(', 'View', ')', ':', '___EOS___']", "index": 62 }, { "content": " def get_authenticator_url(self, secret):\n \"\"\"\n https://code.google.com/p/google-authenticator/wiki/KeyUriFormat\n \"\"\"\n user = 'Flaskwallet' # Yeah, we have no user model\n data = 'otpauth://totp/%s?secret=%s&issuer=%s' % (user, secret,\n 'Flaskwallet')\n return data", "metadata": "root.QRView.get_authenticator_url", "header": "['class', 'QRView', '(', 'View', ')', ':', '___EOS___']", "index": 73 } ]
[ { "span": "import urllib", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 13 }, { "span": "from flask import flash", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 23 }, { "span": "from flask import make_response", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 31 }, { "span": "from flask import redirect", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 26 }, { "span": "from flask import request", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 25 }, { "span": "from flask import url_for", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 25 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "base64_", "import_", "b3", "2e", "ncode", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "flask_", "import_", "abort_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "import_", "flash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "import_", "make", "\\u", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "import_", "render", "\\u", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "import_", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "import_", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "import_", "send", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "import_", "url", "\\u", "for_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "._", "views_", "import_", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "fla", "sk", "wallet_", "import_", "session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "settings", "app_", "._", "models_", "import_", "Setting_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "qrc", "ode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Crypto_", "._", "Random_", "import_", "get", "\\u", "random", "\\u", "bytes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "OT", "PS", "etu", "p", "View_", "(_", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "OT", "PS", "etu", "p", "View_", "(_", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "dispatch", "\\u", "request_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "'", "otp", "/", "setup", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "QR", "View_", "(_", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "http", "://", "www", ".", "bro", "ol", ".", "com", "/", "index", ".", "php", "/", "usi", "ng", "-", "google", "-", "authenticator", "-", "for", "-", "your", "-", "webs", "ite", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "QR", "View_", "(_", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "dispatch", "\\u", "request_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "secret_", "=_", "self_", "._", "get", "\\u", "secret_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "secret_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "send", "\\u", "file_", "(_", "self_", "._", "get", "\\u", "qr_", "(_", "secret_", ")_", ",_", "mimetype_", "=_", "'", "image", "/", "png", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QR", "View_", "(_", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "secret_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Crypto", "graphical", "ly", "-", "secure", " ", "10", " ", "byte", " ", "random", " ", "key", ",", " ", "presente", "d", " ", "to", " ", "the", " ", "user", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "base", "32", " ", "16", "-", "character", " ", "string", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "'", "otp", "secret", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setting_", "=_", "session_", "._", "query_", "(_", "Setting_", ")_", "._", "get_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "setting_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "secret_", "=_", "get", "\\u", "random", "\\u", "bytes_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "b3", "2e", "ncode", "_", "(_", "secret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setting_", "=_", "Setting_", "(_", "name_", ",_", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "._", "add_", "(_", "setting_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QR", "View_", "(_", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "qr_", "(_", "self_", ",_", "secret_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "img", "\\u", "io_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qr_", "=_", "self_", "._", "build", "\\u", "qr", "\\u", "image_", "(_", "secret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qr_", "._", "save_", "(_", "img", "\\u", "io_", ",_", "'", "PNG", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img", "\\u", "io_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "img", "\\u", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QR", "View_", "(_", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "build", "\\u", "qr", "\\u", "image_", "(_", "self_", ",_", "secret_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qr_", "=_", "qrc", "ode_", "._", "QR", "Code_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "error", "\\u", "correction_", "=_", "qrc", "ode_", "._", "constants_", "._", "ERROR", "\\u", "CORREC", "T", "\\u", "L_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "box", "\\u", "size_", "=_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "border_", "=_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qr_", "._", "add", "\\u", "data_", "(_", "self_", "._", "get", "\\u", "authenticator", "\\u", "url_", "(_", "secret_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qr_", "._", "make_", "(_", "fit_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "qr_", "._", "make", "\\u", "image_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QR", "View_", "(_", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "authenticator", "\\u", "url_", "(_", "self_", ",_", "secret_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "https", "://", "code", ".", "google", ".", "com", "/", "p", "/", "google", "-", "authenticator", "/", "wiki", "/", "Key", "Ur", "i", "Format", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "'", "Fla", "sk", "walle", "t", "'_", "#", " ", "Ye", "ah", ",", " ", "we", " ", "have", " ", "no", " ", "user", " ", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "'", "otp", "auth", "://", "tot", "p", "/", "%", "s", "?", "secret", "=", "%", "s", "&", "issue", "r", "=", "%", "s", "'_", "%_", "(_", "user_", ",_", "secret_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Fla", "sk", "walle", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "data_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
bashu/django-easy-maps/easy_maps/south_migrations/0004_auto__del_field_address_longtitude.py
[ { "content": "# encoding: utf-8\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(SchemaMigration):\n\n\n\n\n models = {\n 'easy_maps.address': {\n 'Meta': {'object_name': 'Address'},\n 'address': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),\n 'computed_address': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),\n 'geocode_error': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'latitude': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),\n 'longitude': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'})\n }\n }\n\n complete_apps = ['easy_maps']", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 6 }, { "content": " def forwards(self, orm):\n \n # Deleting field 'Address.longtitude'\n db.delete_column('easy_maps_address', 'longtitude')", "metadata": "root.Migration.forwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 8 }, { "content": " def backwards(self, orm):\n \n # Adding field 'Address.longtitude'\n db.add_column('easy_maps_address', 'longtitude', self.gf('django.db.models.fields.FloatField')(null=True, blank=True), keep_default=False)", "metadata": "root.Migration.backwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 13 } ]
[ { "span": "import datetime", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 15 }, { "span": "from django.db import models", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "encoding", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "db_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "v2_", "import_", "Schema", "Migration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "models_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "easy", "\\u", "maps", ".", "address", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Address", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "address", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "compute", "d\\u", "address", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "geocode", "\\u", "error", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "latitude", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Float", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "longitude", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Float", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "\\u", "apps_", "=_", "[_", "'", "easy", "\\u", "maps", "'_", "]_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "forwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "field", " ", "'", "Address", ".", "long", "titu", "de", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "delete", "\\u", "column_", "(_", "'", "easy", "\\u", "maps", "\\u", "address", "'_", ",_", "'", "long", "titu", "de", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "backwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "field", " ", "'", "Address", ".", "long", "titu", "de", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "add", "\\u", "column_", "(_", "'", "easy", "\\u", "maps", "\\u", "address", "'_", ",_", "'", "long", "titu", "de", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Float", "Field", "'_", ")_", "(_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ",_", "keep", "\\u", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
luugiathuy/WebProxyPython/proxy.py
[ { "content": "#****************************************************\n# *\n# HTTP PROXY *\n# Version: 1.0 *\n# Author: Luu Gia Thuy *\n# *\n#****************************************************\n\nimport os,sys,thread,socket\n\n#********* CONSTANT VARIABLES *********\nBACKLOG = 50 # how many pending connections queue will hold\nMAX_DATA_RECV = 999999 # max number of bytes we receive at once\nDEBUG = True # set to True to see the debug msgs\nBLOCKED = [] # just an example. Remove with [\"\"] for no blocking at all.\n\n#**************************************\n#********* MAIN PROGRAM ***************\n#**************************************\n#************** END MAIN PROGRAM ***************\n\n\n#*******************************************\n#********* PROXY_THREAD FUNC ***************\n# A thread to handle request from browser\n#*******************************************\n#********** END PROXY_THREAD ***********\n \nif __name__ == '__main__':\n main()\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def main():\n\n # check the length of command running\n if (len(sys.argv)<2):\n print \"No port given, using :8080 (http-alt)\" \n port = 8080\n else:\n port = int(sys.argv[1]) # port from argument\n\n # host and port info.\n host = '' # blank for localhost\n \n print \"Proxy Server Running on \",host,\":\",port\n\n try:\n # create a socket\n s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n\n # associate the socket to host and port\n s.bind((host, port))\n\n # listenning\n s.listen(BACKLOG)\n \n except socket.error, (value, message):\n if s:\n s.close()\n print \"Could not open socket:\", message\n sys.exit(1)\n\n # get the connection from client\n while 1:\n conn, client_addr = s.accept()\n\n # create a thread to handle request\n thread.start_new_thread(proxy_thread, (conn, client_addr))\n \n s.close()", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 19 }, { "content": "def printout(type,request,address):\n if \"Block\" in type or \"Blacklist\" in type:\n colornum = 91\n elif \"Request\" in type:\n colornum = 92\n elif \"Reset\" in type:\n colornum = 93\n\n print \"\\033[\",colornum,\"m\",address[0],\"\\t\",type,\"\\t\",request,\"\\033[0m\"", "metadata": "root.printout", "header": "['module', '___EOS___']", "index": 59 }, { "content": "def proxy_thread(conn, client_addr):\n\n # get the request from browser\n request = conn.recv(MAX_DATA_RECV)\n\n # parse the first line\n first_line = request.split('\\n')[0]\n\n # get url\n url = first_line.split(' ')[1]\n\n for i in range(0,len(BLOCKED)):\n if BLOCKED[i] in url:\n printout(\"Blacklisted\",first_line,client_addr)\n conn.close()\n sys.exit(1)\n\n\n printout(\"Request\",first_line,client_addr)\n # print \"URL:\",url\n # print\n \n # find the webserver and port\n http_pos = url.find(\"://\") # find pos of ://\n if (http_pos==-1):\n temp = url\n else:\n temp = url[(http_pos+3):] # get the rest of url\n \n port_pos = temp.find(\":\") # find the port pos (if any)\n\n # find end of web server\n webserver_pos = temp.find(\"/\")\n if webserver_pos == -1:\n webserver_pos = len(temp)\n\n webserver = \"\"\n port = -1\n if (port_pos==-1 or webserver_pos < port_pos): # default port\n port = 80\n webserver = temp[:webserver_pos]\n else: # specific port\n port = int((temp[(port_pos+1):])[:webserver_pos-port_pos-1])\n webserver = temp[:port_pos]\n\n try:\n # create a socket to connect to the web server\n s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) \n s.connect((webserver, port))\n s.send(request) # send request to webserver\n \n while 1:\n # receive data from web server\n data = s.recv(MAX_DATA_RECV)\n \n if (len(data) > 0):\n # send to browser\n conn.send(data)\n else:\n break\n s.close()\n conn.close()\n except socket.error, (value, message):\n if s:\n s.close()\n if conn:\n conn.close()\n printout(\"Peer Reset\",first_line,client_addr)\n sys.exit(1)", "metadata": "root.proxy_thread", "header": "['module', '___EOS___']", "index": 73 } ]
[ { "span": "import os,sys,thread,socket", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 27 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "***********", "***********", "***********", "***********", "********", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", " ", "*_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "HTTP", " ", "PROX", "Y", " ", " ", " ", " ", "*_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Version", ":", " ", "1.0", " ", " ", "*_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Author", ":", " ", "Lu", "u", " ", "Gi", "a", " ", "Thu", "y", " ", " ", " ", " ", "*_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", " ", "*_", "\\u\\u\\uNL\\u\\u\\u_", "#", "***********", "***********", "***********", "***********", "********", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", ",_", "sys_", ",_", "thread_", ",_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "********", "*", " ", "CONSTANT", " ", "VARIABLES", " ", "********", "*_", "\\u\\u\\uNL\\u\\u\\u_", "BACK", "LOG_", "=_", "50_", "#", " ", "how", " ", "many", " ", "pend", "ing", " ", "connections", " ", "queue", " ", "will", " ", "hold_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAX", "\\u", "DATA", "\\u", "REC", "V_", "=_", "999999", "_", "#", " ", "max", " ", "number", " ", "of", " ", "bytes", " ", "we", " ", "receive", " ", "at", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEBUG_", "=_", "True_", "#", " ", "set", " ", "to", " ", "Tru", "e", " ", "to", " ", "see", " ", "the", " ", "debug", " ", "msgs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BLOCK", "ED_", "=_", "[_", "]_", "#", " ", "just", " ", "an", " ", "example", ".", " ", "Remove", " ", "with", " ", "[\"", "\"]", " ", "for", " ", "no", " ", "blockin", "g", " ", "at", " ", "all", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "***********", "***********", "***********", "*****", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "********", "*", " ", "MAIN", " ", "PROGRAM", " ", "***********", "****", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "***********", "***********", "***********", "*****", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "***********", "***", " ", "END", " ", "MAIN", " ", "PROGRAM", " ", "***********", "****", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "***********", "***********", "***********", "********", "**_", "\\u\\u\\uNL\\u\\u\\u_", "#", "********", "*", " ", "PROX", "Y", "\\u", "THREAD", " ", "FUNC", " ", "***********", "****", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "thread", " ", "to", " ", "handle", " ", "request", " ", "from", " ", "browser_", "\\u\\u\\uNL\\u\\u\\u_", "#", "***********", "***********", "***********", "********", "**_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "********", "**", " ", "END", " ", "PROX", "Y", "\\u", "THREAD", " ", "***********", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "the", " ", "length", " ", "of", " ", "command", " ", "running_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "len_", "(_", "sys_", "._", "argv_", ")_", "<_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "No", " ", "port", " ", "give", "n", ",", " ", "usi", "ng", " ", ":", "808", "0", " ", "(", "http", "-", "alt", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "8080_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port_", "=_", "int_", "(_", "sys_", "._", "argv_", "[_", "1_", "]_", ")_", "#", " ", "port", " ", "from", " ", "argument_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "host", " ", "and", " ", "port", " ", "info", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "host_", "=_", "''_", "#", " ", "blank", " ", "for", " ", "local", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "Pro", "xy", " ", "Server", " ", "Run", "ning", " ", "on", " ", "\"_", ",_", "host_", ",_", "\":\"_", ",_", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "socket_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "socket_", "._", "socket_", "(_", "socket_", "._", "AF", "\\u", "INET_", ",_", "socket_", "._", "SOCK", "\\u", "STREAM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "associate", " ", "the", " ", "socket", " ", "to", " ", "host", " ", "and", " ", "port_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "bind_", "(_", "(_", "host_", ",_", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "listen", "ning_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "listen_", "(_", "BACK", "LOG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", ",_", "(_", "value_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "Cou", "ld", " ", "not", " ", "open", " ", "socket", ":\"_", ",_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "connecti", "on", " ", "from", " ", "client_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", ",_", "client", "\\u", "addr_", "=_", "s_", "._", "accept_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "thread", " ", "to", " ", "handle", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "thread_", "._", "start", "\\u", "new", "\\u", "thread_", "(_", "proxy", "\\u", "thread_", ",_", "(_", "conn_", ",_", "client", "\\u", "addr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "printo", "ut_", "(_", "type_", ",_", "request_", ",_", "address_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"", "Block", "\"_", "in_", "type_", "or_", "\"", "Black", "list", "\"_", "in_", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "color", "num_", "=_", "91_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\"", "Request", "\"_", "in_", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "color", "num_", "=_", "92_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\"", "Reset", "\"_", "in_", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "color", "num_", "=_", "93_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"\\\\", "033", "[\"_", ",_", "color", "num_", ",_", "\"", "m", "\"_", ",_", "address_", "[_", "0_", "]_", ",_", "\"\\\\", "t", "\"_", ",_", "type_", ",_", "\"\\\\", "t", "\"_", ",_", "request_", ",_", "\"\\\\", "033", "[", "0", "m", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "proxy", "\\u", "thread_", "(_", "conn_", ",_", "client", "\\u", "addr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "request", " ", "from", " ", "browser_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "conn_", "._", "recv_", "(_", "MAX", "\\u", "DATA", "\\u", "REC", "V_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parse", " ", "the", " ", "first", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "first", "\\u", "line_", "=_", "request_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "url_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "first", "\\u", "line_", "._", "split_", "(_", "'", " ", "'_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "len_", "(_", "BLOCK", "ED_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "BLOCK", "ED_", "[_", "i_", "]_", "in_", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "printo", "ut_", "(_", "\"", "Black", "liste", "d", "\"_", ",_", "first", "\\u", "line_", ",_", "client", "\\u", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "printo", "ut_", "(_", "\"", "Request", "\"_", ",_", "first", "\\u", "line_", ",_", "client", "\\u", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "\"", "URL", ":\"", ",", "url_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "the", " ", "webse", "rver", " ", "and", " ", "port_", "\\u\\u\\uNL\\u\\u\\u_", "http", "\\u", "pos_", "=_", "url_", "._", "find_", "(_", "\":", "//", "\"_", ")_", "#", " ", "find", " ", "pos", " ", "of", " ", "://", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "http", "\\u", "pos_", "==_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp_", "=_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp_", "=_", "url_", "[_", "(_", "http", "\\u", "pos_", "+_", "3_", ")_", ":_", "]_", "#", " ", "get", " ", "the", " ", "rest", " ", "of", " ", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "port", "\\u", "pos_", "=_", "temp_", "._", "find_", "(_", "\":\"_", ")_", "#", " ", "find", " ", "the", " ", "port", " ", "pos", " ", "(", "if", " ", "any", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "end", " ", "of", " ", "web", " ", "server_", "\\u\\u\\uNL\\u\\u\\u_", "webse", "rver", "\\u", "pos_", "=_", "temp_", "._", "find_", "(_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "webse", "rver", "\\u", "pos_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "webse", "rver", "\\u", "pos_", "=_", "len_", "(_", "temp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "webse", "rver_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "port", "\\u", "pos_", "==_", "-_", "1_", "or_", "webse", "rver", "\\u", "pos_", "<_", "port", "\\u", "pos_", ")_", ":_", "#", " ", "default", " ", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port_", "=_", "80_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "webse", "rver_", "=_", "temp_", "[_", ":_", "webse", "rver", "\\u", "pos_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "specific", " ", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port_", "=_", "int_", "(_", "(_", "temp_", "[_", "(_", "port", "\\u", "pos_", "+_", "1_", ")_", ":_", "]_", ")_", "[_", ":_", "webse", "rver", "\\u", "pos_", "-_", "port", "\\u", "pos_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "webse", "rver_", "=_", "temp_", "[_", ":_", "port", "\\u", "pos_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "socket", " ", "to", " ", "connect", " ", "to", " ", "the", " ", "web", " ", "server_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "socket_", "._", "socket_", "(_", "socket_", "._", "AF", "\\u", "INET_", ",_", "socket_", "._", "SOCK", "\\u", "STREAM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "connect_", "(_", "(_", "webse", "rver_", ",_", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "send_", "(_", "request_", ")_", "#", " ", "send", " ", "request", " ", "to", " ", "webse", "rver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "receive", " ", "data", " ", "from", " ", "web", " ", "server_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "s_", "._", "recv_", "(_", "MAX", "\\u", "DATA", "\\u", "REC", "V_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "len_", "(_", "data_", ")_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "send", " ", "to", " ", "browser_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "send_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", ",_", "(_", "value_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "printo", "ut_", "(_", "\"", "Peer", " ", "Reset", "\"_", ",_", "first", "\\u", "line_", ",_", "client", "\\u", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
zbyte64/django-dockit/dockit/backends/djangodocument/indexers.py
[ { "content": " def generate_index(self):\n collection = self.document._meta.collection\n field = self.document._meta.dot_notation_to_field(self.dotpath)\n \n subindex = self._lookup_index(field)\n if subindex is None and hasattr(field, 'subfield'):\n subindex = self._lookup_index(field.subfield)\n \n if subindex is None:\n subindex = indexes.StringIndex\n #raise TypeError(\"Could not identify an apropriate index for: %s\" % field)\n \n self.subindex = subindex\n func = Indexer(self.document, subindex.objects.db_index, self.dotpath, self.filter_operation.key)\n filt = subindex.objects.filter_kwargs_for_operation\n values = subindex.objects.values\n clear = subindex.objects.clear_db_index\n \n self.index_functions = {'map':func, 'filter':filt, 'values':values, 'clear':clear}", "metadata": "root.ExactIndexer.generate_index", "header": "['class', 'ExactIndexer', '(', 'BaseIndexer', ')', ':', '___EOS___']", "index": 53 } ]
[ { "span": "collection ", "start_line": 54, "start_column": 8, "end_line": 54, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Exa", "ct", "Indexer", "_", "(_", "Base", "Indexer", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e\\u", "index_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "collection_", "=_", "self_", "._", "document_", "._", "\\u", "meta_", "._", "collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field_", "=_", "self_", "._", "document_", "._", "\\u", "meta_", "._", "dot", "\\u", "notation", "\\u", "to", "\\u", "field_", "(_", "self_", "._", "dot", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "subin", "dex_", "=_", "self_", "._", "\\u", "look", "up", "\\u", "index_", "(_", "field_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "subin", "dex_", "is_", "None_", "and_", "hasattr_", "(_", "field_", ",_", "'", "subfield", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subin", "dex_", "=_", "self_", "._", "\\u", "look", "up", "\\u", "index_", "(_", "field_", "._", "subfield", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "subin", "dex_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subin", "dex_", "=_", "indexes_", "._", "String", "Index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "raise", " ", "Type", "Error", "(\"", "Cou", "ld", " ", "not", " ", "identify", " ", "an", " ", "apro", "pri", "ate", " ", "index", " ", "for", ":", " ", "%", "s", "\"", " ", "%", " ", "field", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "subin", "dex_", "=_", "subin", "dex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "func_", "=_", "Indexer", "_", "(_", "self_", "._", "document_", ",_", "subin", "dex_", "._", "objects_", "._", "db", "\\u", "index_", ",_", "self_", "._", "dot", "path_", ",_", "self_", "._", "filter", "\\u", "operation_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filt_", "=_", "subin", "dex_", "._", "objects_", "._", "filter", "\\u", "kwarg", "s", "\\u", "for", "\\u", "operation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "=_", "subin", "dex_", "._", "objects_", "._", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clear_", "=_", "subin", "dex_", "._", "objects_", "._", "clear", "\\u", "db", "\\u", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "index", "\\u", "functions_", "=_", "{_", "'", "map", "'_", ":_", "func_", ",_", "'", "filter", "'_", ":_", "filt_", ",_", "'", "values", "'_", ":_", "values_", ",_", "'", "clear", "'_", ":_", "clear_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
balanced/status.balancedpayments.com/venv/lib/python2.7/site-packages/unittest2/test/test_case.py
[ { "content": " def test_failureException__default(self):\n class Foo(unittest2.TestCase):\n def test(self):\n pass\n\n self.assertTrue(Foo('test').failureException is AssertionError)", "metadata": "root.Test_TestCase.test_failureException__default", "header": "['class', 'Test_TestCase', '(', 'unittest2', '.', 'TestCase', ',', 'EqualityMixin', ',', 'HashingMixin', ')', ':', '___NEWLINE___', '___NL___', '### Set up attributes used by inherited tests', '___NL___', '################################################################', '___NL___', '___NL___', '# Used by HashingMixin.test_hash and EqualityMixin.test_eq', '___NL___', '___EOS___']", "index": 422 }, { "content": " def test_failureException__subclassing__explicit_raise(self):\n events = []\n result = LoggingResult(events)\n\n class Foo(unittest2.TestCase):\n def test(self):\n raise RuntimeError()\n\n failureException = RuntimeError\n\n self.assertTrue(Foo('test').failureException is RuntimeError)\n\n\n Foo('test').run(result)\n expected = ['startTest', 'addFailure', 'stopTest']\n self.assertEqual(events, expected)", "metadata": "root.Test_TestCase.test_failureException__subclassing__explicit_raise", "header": "['class', 'Test_TestCase', '(', 'unittest2', '.', 'TestCase', ',', 'EqualityMixin', ',', 'HashingMixin', ')', ':', '___NEWLINE___', '___NL___', '### Set up attributes used by inherited tests', '___NL___', '################################################################', '___NL___', '___NL___', '# Used by HashingMixin.test_hash and EqualityMixin.test_eq', '___NL___', '___EOS___']", "index": 435 }, { "content": " def test_failureException__subclassing__implicit_raise(self):\n events = []\n result = LoggingResult(events)\n\n class Foo(unittest2.TestCase):\n def test(self):\n self.fail(\"foo\")\n\n failureException = RuntimeError\n\n self.assertTrue(Foo('test').failureException is RuntimeError)\n\n\n Foo('test').run(result)\n expected = ['startTest', 'addFailure', 'stopTest']\n self.assertEqual(events, expected)", "metadata": "root.Test_TestCase.test_failureException__subclassing__implicit_raise", "header": "['class', 'Test_TestCase', '(', 'unittest2', '.', 'TestCase', ',', 'EqualityMixin', ',', 'HashingMixin', ')', ':', '___NEWLINE___', '___NL___', '### Set up attributes used by inherited tests', '___NL___', '################################################################', '___NL___', '___NL___', '# Used by HashingMixin.test_hash and EqualityMixin.test_eq', '___NL___', '___EOS___']", "index": 458 }, { "content": " def testAssertMultiLineEqual(self):\n sample_text = \"\"\"\\\nhttp://www.python.org/doc/2.3/lib/module-unittest.html\ntest case\n A test case is the smallest unit of testing. [...]\n\"\"\"\n revised_sample_text = \"\"\"\\\nhttp://www.python.org/doc/2.4.1/lib/module-unittest.html\ntest case\n A test case is the smallest unit of testing. [...] You may provide your\n own implementation that does not subclass from TestCase, of course.\n\"\"\"\n sample_text_error = \"\"\"\\\n- http://www.python.org/doc/2.3/lib/module-unittest.html\n? ^\n+ http://www.python.org/doc/2.4.1/lib/module-unittest.html\n? ^^^\n test case\n- A test case is the smallest unit of testing. [...]\n+ A test case is the smallest unit of testing. [...] You may provide your\n? +++++++++++++++++++++\n+ own implementation that does not subclass from TestCase, of course.\n\"\"\"\n self.maxDiff = None\n for type_changer in (lambda x: x, lambda x: x.decode('utf8')):\n try:\n self.assertMultiLineEqual(type_changer(sample_text),\n type_changer(revised_sample_text))\n except self.failureException, e:\n # need to remove the first line of the error message\n error = str(e).encode('utf8').split('\\n', 1)[1]\n\n # assertMultiLineEqual is hooked up as the default for\n # unicode strings - so we can't use it for this check\n self.assertTrue(sample_text_error == error)", "metadata": "root.Test_TestCase.testAssertMultiLineEqual", "header": "['class', 'Test_TestCase', '(', 'unittest2', '.', 'TestCase', ',', 'EqualityMixin', ',', 'HashingMixin', ')', ':', '___NEWLINE___', '___NL___', '### Set up attributes used by inherited tests', '___NL___', '################################################################', '___NL___', '___NL___', '# Used by HashingMixin.test_hash and EqualityMixin.test_eq', '___NL___', '___EOS___']", "index": 867 }, { "content": " def testAssertSequenceEqualMaxDiff(self):\n self.assertEqual(self.maxDiff, 80*8)\n seq1 = 'a' + 'x' * 80**2\n seq2 = 'b' + 'x' * 80**2\n diff = '\\n'.join(difflib.ndiff(pprint.pformat(seq1).splitlines(),\n pprint.pformat(seq2).splitlines()))\n # the +1 is the leading \\n added by assertSequenceEqual\n omitted = unittest2.case.DIFF_OMITTED % (len(diff) + 1,)\n\n self.maxDiff = len(diff)//2\n try:\n self.assertSequenceEqual(seq1, seq2)\n except self.failureException, e:\n msg = e.args[0]\n else:\n self.fail('assertSequenceEqual did not fail.')\n self.assertTrue(len(msg) < len(diff))\n self.assertIn(omitted, msg)\n\n self.maxDiff = len(diff) * 2\n try:\n self.assertSequenceEqual(seq1, seq2)\n except self.failureException, e:\n msg = e.args[0]\n else:\n self.fail('assertSequenceEqual did not fail.')\n self.assertTrue(len(msg) > len(diff))\n self.assertNotIn(omitted, msg)\n\n self.maxDiff = None\n try:\n self.assertSequenceEqual(seq1, seq2)\n except self.failureException, e:\n msg = e.args[0]\n else:\n self.fail('assertSequenceEqual did not fail.')\n self.assertTrue(len(msg) > len(diff))\n self.assertNotIn(omitted, msg)", "metadata": "root.Test_TestCase.testAssertSequenceEqualMaxDiff", "header": "['class', 'Test_TestCase', '(', 'unittest2', '.', 'TestCase', ',', 'EqualityMixin', ',', 'HashingMixin', ')', ':', '___NEWLINE___', '___NL___', '### Set up attributes used by inherited tests', '___NL___', '################################################################', '___NL___', '___NL___', '# Used by HashingMixin.test_hash and EqualityMixin.test_eq', '___NL___', '___EOS___']", "index": 903 } ]
[ { "span": "self.assertTrue(Foo('test').failureException is AssertionError)", "start_line": 427, "start_column": 8, "end_line": 427, "end_column": 71 }, { "span": "self.assertTrue(Foo('test').failureException is RuntimeError)", "start_line": 445, "start_column": 8, "end_line": 445, "end_column": 69 }, { "span": "self.assertTrue(Foo('test').failureException is RuntimeError)", "start_line": 468, "start_column": 8, "end_line": 468, "end_column": 69 }, { "span": "self.assertTrue(sample_text_error == error)", "start_line": 901, "start_column": 16, "end_line": 901, "end_column": 59 }, { "span": "self.assertTrue(len(msg) < len(diff))", "start_line": 919, "start_column": 8, "end_line": 919, "end_column": 45 }, { "span": "self.assertTrue(len(msg) > len(diff))", "start_line": 929, "start_column": 8, "end_line": 929, "end_column": 45 }, { "span": "self.assertTrue(len(msg) > len(diff))", "start_line": 939, "start_column": 8, "end_line": 939, "end_column": 45 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "\\u", "Test", "Case_", "(_", "unittest2_", "._", "Test", "Case_", ",_", "Equali", "ty", "Mixin_", ",_", "Hash", "ing", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Set", " ", "up", " ", "attribute", "s", " ", "used", " ", "by", " ", "inherited", " ", "tests_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "ed", " ", "by", " ", "Hash", "ing", "Mix", "in", ".", "test\\u", "hash", " ", "and", " ", "Equali", "ty", "Mix", "in", ".", "test\\u", "eq_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "fail", "ure", "Except", "ion", "\\u\\u", "default_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Foo_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "Foo_", "(_", "'", "test", "'_", ")_", "._", "fail", "ure", "Exception_", "is_", "Assert", "ion", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "Test", "Case_", "(_", "unittest2_", "._", "Test", "Case_", ",_", "Equali", "ty", "Mixin_", ",_", "Hash", "ing", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Set", " ", "up", " ", "attribute", "s", " ", "used", " ", "by", " ", "inherited", " ", "tests_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "ed", " ", "by", " ", "Hash", "ing", "Mix", "in", ".", "test\\u", "hash", " ", "and", " ", "Equali", "ty", "Mix", "in", ".", "test\\u", "eq_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "fail", "ure", "Except", "ion", "\\u\\u", "subclassing", "\\u\\u", "explicit", "\\u", "raise_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "events_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "Log", "ging", "Result_", "(_", "events_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Foo_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fail", "ure", "Exception_", "=_", "Run", "time", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "Foo_", "(_", "'", "test", "'_", ")_", "._", "fail", "ure", "Exception_", "is_", "Run", "time", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Foo_", "(_", "'", "test", "'_", ")_", "._", "run_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "[_", "'", "start", "Test", "'_", ",_", "'", "add", "Fail", "ure", "'_", ",_", "'", "stop", "Test", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "events_", ",_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "Test", "Case_", "(_", "unittest2_", "._", "Test", "Case_", ",_", "Equali", "ty", "Mixin_", ",_", "Hash", "ing", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Set", " ", "up", " ", "attribute", "s", " ", "used", " ", "by", " ", "inherited", " ", "tests_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "ed", " ", "by", " ", "Hash", "ing", "Mix", "in", ".", "test\\u", "hash", " ", "and", " ", "Equali", "ty", "Mix", "in", ".", "test\\u", "eq_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "fail", "ure", "Except", "ion", "\\u\\u", "subclassing", "\\u\\u", "implicit", "\\u", "raise_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "events_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "Log", "ging", "Result_", "(_", "events_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Foo_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fail", "ure", "Exception_", "=_", "Run", "time", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "Foo_", "(_", "'", "test", "'_", ")_", "._", "fail", "ure", "Exception_", "is_", "Run", "time", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Foo_", "(_", "'", "test", "'_", ")_", "._", "run_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "[_", "'", "start", "Test", "'_", ",_", "'", "add", "Fail", "ure", "'_", ",_", "'", "stop", "Test", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "events_", ",_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "Test", "Case_", "(_", "unittest2_", "._", "Test", "Case_", ",_", "Equali", "ty", "Mixin_", ",_", "Hash", "ing", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Set", " ", "up", " ", "attribute", "s", " ", "used", " ", "by", " ", "inherited", " ", "tests_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "ed", " ", "by", " ", "Hash", "ing", "Mix", "in", ".", "test\\u", "hash", " ", "and", " ", "Equali", "ty", "Mix", "in", ".", "test\\u", "eq_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Assert", "Multi", "Line", "Equal_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sample", "\\u", "text_", "=_", "\"\"\"", "\\\\", "\\", "10", ";", "http", "://", "www", ".", "python", ".", "org", "/", "doc", "/", "2.3", "/", "lib", "/", "module", "-", "unittest", ".", "html", "\\", "10", ";", "test", " ", "case", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "test", " ", "case", " ", "is", " ", "the", " ", "smallest", " ", "unit", " ", "of", " ", "testi", "ng", ".", " ", "[...", "]", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "revis", "ed", "\\u", "sample", "\\u", "text_", "=_", "\"\"\"", "\\\\", "\\", "10", ";", "http", "://", "www", ".", "python", ".", "org", "/", "doc", "/", "2.4", ".1", "/", "lib", "/", "module", "-", "unittest", ".", "html", "\\", "10", ";", "test", " ", "case", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "test", " ", "case", " ", "is", " ", "the", " ", "smallest", " ", "unit", " ", "of", " ", "testi", "ng", ".", " ", "[...", "]", " ", "You", " ", "may", " ", "provide", " ", "your", "\\", "10", ";", " ", " ", " ", " ", "own", " ", "implementation", " ", "tha", "t", " ", "doe", "s", " ", "not", " ", "subclass", " ", "from", " ", "Test", "Case", ",", " ", "of", " ", "course", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sample", "\\u", "text", "\\u", "error_", "=_", "\"\"\"", "\\\\", "\\", "10", ";", "-", " ", "http", "://", "www", ".", "python", ".", "org", "/", "doc", "/", "2.3", "/", "lib", "/", "module", "-", "unittest", ".", "html", "\\", "10", ";", "?", " ", " ", " ", "^", "\\", "10", ";", "+", " ", "http", "://", "www", ".", "python", ".", "org", "/", "doc", "/", "2.4", ".1", "/", "lib", "/", "module", "-", "unittest", ".", "html", "\\", "10", ";", "?", " ", " ", " ", "^", "^", "^", "\\", "10", ";", " ", " ", "test", " ", "case", "\\", "10", ";", "-", " ", "A", " ", "test", " ", "case", " ", "is", " ", "the", " ", "smallest", " ", "unit", " ", "of", " ", "testi", "ng", ".", " ", "[...", "]", "\\", "10", ";", "+", " ", "A", " ", "test", " ", "case", " ", "is", " ", "the", " ", "smallest", " ", "unit", " ", "of", " ", "testi", "ng", ".", " ", "[...", "]", " ", "You", " ", "may", " ", "provide", " ", "your", "\\", "10", ";", "?", " ", " ", " ", " ", " ", " ", " ", "++++++", "++++++", "++++++", "+++", "\\", "10", ";", "+", " ", "own", " ", "implementation", " ", "tha", "t", " ", "doe", "s", " ", "not", " ", "subclass", " ", "from", " ", "Test", "Case", ",", " ", "of", " ", "course", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "max", "Diff_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "type", "\\u", "change", "r_", "in_", "(_", "lambda_", "x_", ":_", "x_", ",_", "lambda_", "x_", ":_", "x_", "._", "decode_", "(_", "'", "utf", "8", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Multi", "Line", "Equal_", "(_", "type", "\\u", "change", "r_", "(_", "sample", "\\u", "text_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type", "\\u", "change", "r_", "(_", "revis", "ed", "\\u", "sample", "\\u", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "self_", "._", "fail", "ure", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "need", " ", "to", " ", "remove", " ", "the", " ", "first", " ", "line", " ", "of", " ", "the", " ", "error", " ", "message_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "str_", "(_", "e_", ")_", "._", "encode_", "(_", "'", "utf", "8", "'_", ")_", "._", "split_", "(_", "'\\\\", "n", "'_", ",_", "1_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assert", "Multi", "Line", "Equal", " ", "is", " ", "hooke", "d", " ", "up", " ", "as", " ", "the", " ", "default", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unicode", " ", "string", "s", " ", "-", " ", "so", " ", "we", " ", "can", "'", "t", " ", "use", " ", "it", " ", "for", " ", "this", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "sample", "\\u", "text", "\\u", "error_", "==_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "Test", "Case_", "(_", "unittest2_", "._", "Test", "Case_", ",_", "Equali", "ty", "Mixin_", ",_", "Hash", "ing", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Set", " ", "up", " ", "attribute", "s", " ", "used", " ", "by", " ", "inherited", " ", "tests_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "ed", " ", "by", " ", "Hash", "ing", "Mix", "in", ".", "test\\u", "hash", " ", "and", " ", "Equali", "ty", "Mix", "in", ".", "test\\u", "eq_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Assert", "Sequ", "ence", "Equal", "Max", "Diff_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "max", "Diff_", ",_", "80_", "*_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seq1_", "=_", "'", "a", "'_", "+_", "'", "x", "'_", "*_", "80_", "**_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seq2_", "=_", "'", "b", "'_", "+_", "'", "x", "'_", "*_", "80_", "**_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diff_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "difflib", "_", "._", "ndi", "ff_", "(_", "pprint_", "._", "pformat_", "(_", "seq1_", ")_", "._", "splitlines_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pprint_", "._", "pformat_", "(_", "seq2_", ")_", "._", "splitlines_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "+", "1", " ", "is", " ", "the", " ", "lead", "ing", " ", "\\\\", "n", " ", "adde", "d", " ", "by", " ", "assert", "Sequ", "ence", "Equal_", "\\u\\u\\uNL\\u\\u\\u_", "omit", "ted_", "=_", "unittest2_", "._", "case_", "._", "DIFF", "\\u", "OM", "IT", "TED_", "%_", "(_", "len_", "(_", "diff_", ")_", "+_", "1_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "max", "Diff_", "=_", "len_", "(_", "diff_", ")_", "//_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Sequ", "ence", "Equal_", "(_", "seq1_", ",_", "seq2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "self_", "._", "fail", "ure", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "e_", "._", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "assert", "Sequ", "ence", "Equal", " ", "did", " ", "not", " ", "fail", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "msg_", ")_", "<_", "len_", "(_", "diff_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "omit", "ted_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "max", "Diff_", "=_", "len_", "(_", "diff_", ")_", "*_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Sequ", "ence", "Equal_", "(_", "seq1_", ",_", "seq2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "self_", "._", "fail", "ure", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "e_", "._", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "assert", "Sequ", "ence", "Equal", " ", "did", " ", "not", " ", "fail", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "msg_", ")_", ">_", "len_", "(_", "diff_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "In_", "(_", "omit", "ted_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "max", "Diff_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Sequ", "ence", "Equal_", "(_", "seq1_", ",_", "seq2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "self_", "._", "fail", "ure", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "e_", "._", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "assert", "Sequ", "ence", "Equal", " ", "did", " ", "not", " ", "fail", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "msg_", ")_", ">_", "len_", "(_", "diff_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "In_", "(_", "omit", "ted_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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]
Module is imported with 'import' and 'import from'
pingali/dgit/dgitcore/datasets/common.py
[ { "content": "#!/usr/bin/env python\n\"\"\"\nThis is the core module for manipulating the dataset metadata\n\"\"\"\nimport os, sys, copy, fnmatch, re, shutil\nimport yaml, json, tempfile, mimetypes\nimport webbrowser, traceback, collections\nimport subprocess, string, random, pipes\nfrom collections import OrderedDict\nimport shelve, getpass\nfrom datetime import datetime\nfrom hashlib import sha256\nimport mimetypes\nimport platform\nimport uuid, shutil\nimport boto3, glob2\nimport subprocess\nfrom dateutil import parser\ntry:\n from urllib.parse import urlparse\nexcept:\n from urlparse import urlparse\nfrom ..config import get_config\nfrom ..plugins.common import plugins_get_mgr\nfrom ..helper import bcolors, clean_str, cd, compute_sha256, run, clean_name, log_repo_action \nfrom ..exceptions import *\nfrom .history import get_history, get_diffs\nfrom .validation import validate\n\n#####################################################\n# Exports\n#####################################################\n\n__all__ = [\n 'lookup',\n 'list_repos',\n 'shellcmd',\n 'log', 'show', 'push', 'pull', 'commit',\n 'stash', 'drop', 'status', 'post',\n 'clone', 'init', 'diff',\n 'remote', 'delete'\n]\n\n#####################################################\n# Repo independent commands...\n#####################################################\n\n\n\n#####################################################\n# Repo specific generic commands\n#####################################################\n\n\n\n#####################################################\n# Repo specific simple commands\n#####################################################\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n#####################################################\n# Initialize a repo\n#####################################################\n\n\n\n\n\n###########################################################\n# Post metadata to a server\n###########################################################\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import webbrowser, traceback, collections", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 41 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Thi", "s", " ", "is", " ", "the", " ", "core", " ", "module", " ", "for", " ", "manipulati", "ng", " ", "the", " ", "dataset", " ", "metadata", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", ",_", "sys_", ",_", "copy_", ",_", "fnmatch_", ",_", "re_", ",_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "yaml_", ",_", "json_", ",_", "tempfile_", ",_", "mimetypes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "webbrowser_", ",_", "traceback_", ",_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", ",_", "string_", ",_", "random_", ",_", "pipes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "Order", "ed", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shelve", "_", ",_", "getpass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "hashlib_", "import_", "sha256_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mimetypes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "uuid_", ",_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "boto3_", ",_", "glob", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dateutil_", "import_", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "urllib_", "._", "parse_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "urlparse_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "._", "._", "config_", "import_", "get", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "plugins_", "._", "common_", "import_", "plugin", "s", "\\u", "get", "\\u", "mgr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "helper_", "import_", "bcolors_", ",_", "clean", "\\u", "str_", ",_", "cd_", ",_", "compute", "\\u", "sha256_", ",_", "run_", ",_", "clean", "\\u", "name_", ",_", "log", "\\u", "repo", "\\u", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "exceptions_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "history_", "import_", "get", "\\u", "history_", ",_", "get", "\\u", "diffs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "validation_", "import_", "validate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Export", "s_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "look", "up", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "list", "\\u", "repos", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "shellc", "md", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "log", "'_", ",_", "'", "show", "'_", ",_", "'", "push", "'_", ",_", "'", "pull", "'_", ",_", "'", "commit", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "stash", "'_", ",_", "'", "drop", "'_", ",_", "'", "status", "'_", ",_", "'", "post", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "clone", "'_", ",_", "'", "init", "'_", ",_", "'", "diff", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "remote", "'_", ",_", "'", "delete", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rep", "o", " ", "independent", " ", "command", "s", "..._", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rep", "o", " ", "specific", " ", "gener", "ic", " ", "commands_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rep", "o", " ", "specific", " ", "simple", " ", "commands_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initializ", "e", " ", "a", " ", "repo_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Post", " ", "metadata", " ", "to", " ", "a", " ", "server_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
gvlproject/gvl_commandline_utilities/roles/gvl.commandline-utilities/files/galaxy-fuse.py
[ { "content": "#!/usr/bin/env python\n\n\"\"\"\ngalaxy-fuse.py will mount Galaxy datasets for direct read access using FUSE.\n\nTo do this you will need your Galaxy API key, found by logging into Galaxy and\nselecting the menu option User -> API Keys. You can mount your Galaxy datasets\nusing a command like\n\n python galaxy-fuse.py <api-key> &\n\nThis puts the galaxy-fuse process into the background. Galaxy Datasets will then\nappear as read-only files, organised by History, under the directory galaxy_files.\n\ngalaxy-fuse was written by Dr David Powell and began life at\nhttps://github.com/drpowell/galaxy-fuse .\n\"\"\"\n\nfrom errno import ENOENT\nfrom stat import S_IFDIR, S_IFREG, S_IFLNK\nfrom sys import argv, exit\nimport re\nimport time\nimport os\nimport argparse\n\nfrom fuse import FUSE, FuseOSError, Operations, LoggingMixIn, fuse_get_context\n\nfrom bioblend import galaxy\n\n# number of seconds to cache history/dataset lookups\nCACHE_TIME = 3\n\n# Split a path into hash of components\n\n# Escape/unescape slashes in filenames\n\n# Escape/unescape slashes in filenames\n\n\n\n\n\nif __name__ == '__main__':\n\n parser = argparse.ArgumentParser(description=\"Mount Galaxy Datasets for direct read access using FUSE.\")\n parser.add_argument(\"apikey\",\n help=\"Galaxy API key for the account to read\")\n parser.add_argument(\"-m\", \"--mountpoint\", default=\"galaxy_files\",\n help=\"Directory under which to mount the Galaxy Datasets.\")\n args = parser.parse_args()\n\n # Create the directory if it does not exist\n if not os.path.exists(args.mountpoint):\n os.makedirs(args.mountpoint)\n\n fuse = FUSE(Context(args.apikey),\n args.mountpoint,\n foreground=True,\n ro=True)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def path_type(path):\n parts = filter(lambda x: len(x)>0, path.split('/'))\n if path=='/':\n return ('root',dict())\n elif path=='/histories':\n return ('histories',dict())\n elif len(parts)==2 and parts[0]=='histories':\n return ('datasets',dict(h_name=unesc_filename(parts[1])))\n elif len(parts)==3 and parts[0]=='histories':\n return ('data',dict(h_name=unesc_filename(parts[1]), ds_name=unesc_filename(parts[2])))\n print \"Unknown : %s\"%path\n return ('',0)", "metadata": "root.path_type", "header": "['module', '___EOS___']", "index": 34 }, { "content": "def esc_filename(fname):\n def esc(m):\n c=m.group(0)\n if c=='%':\n return '%%'\n elif c=='/':\n return '%-'\n return re.sub(r'%|/', esc, fname)", "metadata": "root.esc_filename", "header": "['module', '___EOS___']", "index": 48 }, { "content": "def unesc_filename(fname):\n def unesc(m):\n str=m.group(0)\n if str=='%%':\n return '%'\n elif str=='%-':\n return '/'\n\n return re.sub(r'%(.)', unesc, fname)", "metadata": "root.unesc_filename", "header": "['module', '___EOS___']", "index": 58 }, { "content": "def parse_name_with_id(fname):\n #1cd8e2f6b131e891\n m = re.match(r\"^(?P<name>.*)-(?P<id>[0-9a-f]{16})\", fname)\n if m is not None:\n return (m.group('name'), m.group('id'))\n else:\n return (fname,'')", "metadata": "root.parse_name_with_id", "header": "['module', '___EOS___']", "index": 68 }, { "content": "class Context(LoggingMixIn, Operations):\n 'Prototype FUSE to galaxy histories'\n\n\n\n # Return a symlink for the given dataset\n\n\n # Lookup all histories in galaxy; cache\n\n # Find a specific history by name\n\n # Lookup all datasets in the specified history; cache\n\n # Find a specific dataset - the 'kw' parameter is from path_type() above\n\n # read directory contents\n\n # Disable unused operations:\n access = None\n flush = None\n getxattr = None\n listxattr = None\n open = None\n opendir = None\n release = None\n releasedir = None\n statfs = None", "metadata": "root.Context", "header": "['module', '___EOS___']", "index": 77 }, { "content": " def __init__(self, api_key):\n self.gi = galaxy.GalaxyInstance(url='http://127.0.0.1:80/galaxy/', key=api_key)\n self.datasets_cache = {}\n self.histories_cache = {'time':None, 'contents':None}", "metadata": "root.Context.__init__", "header": "['class', 'Context', '(', 'LoggingMixIn', ',', 'Operations', ')', ':', '___EOS___']", "index": 80 }, { "content": " def getattr(self, path, fh=None):\n #uid, gid, pid = fuse_get_context()\n (typ,kw) = path_type(path)\n now = time.time()\n if typ=='root' or typ=='histories':\n # Simple directory\n st = dict(st_mode=(S_IFDIR | 0555), st_nlink=2)\n st['st_ctime'] = st['st_mtime'] = st['st_atime'] = now\n elif typ=='datasets':\n # Simple directory\n st = dict(st_mode=(S_IFDIR | 0555), st_nlink=2)\n st['st_ctime'] = st['st_mtime'] = st['st_atime'] = now\n elif typ=='data':\n # A file, will be a symlink to a galaxy dataset\n d = self._dataset(kw)\n t = time.mktime(time.strptime(d['update_time'],'%Y-%m-%dT%H:%M:%S.%f'))\n fname = esc_filename(d.get('file_path', d['file_name']))\n st = dict(st_mode=(S_IFLNK | 0444), st_nlink=1,\n st_size=len(fname), st_ctime=t, st_mtime=t,\n st_atime=t)\n #st = dict(st_mode=(S_IFREG | 0444), st_nlink=1,\n # st_size=fname, st_ctime=t, st_mtime=t,\n # st_atime=t)\n else:\n raise FuseOSError(ENOENT)\n return st", "metadata": "root.Context.getattr", "header": "['class', 'Context', '(', 'LoggingMixIn', ',', 'Operations', ')', ':', '___EOS___']", "index": 85 }, { "content": " def readlink(self, path):\n (typ,kw) = path_type(path)\n if typ=='data':\n d = self._dataset(kw)\n # We have already checked that one of these keys is present\n return d.get('file_path', d['file_name'])\n raise FuseOSError(ENOENT)", "metadata": "root.Context.readlink", "header": "['class', 'Context', '(', 'LoggingMixIn', ',', 'Operations', ')', ':', '___EOS___']", "index": 113 }, { "content": " def read(self, path, size, offset, fh):\n raise RuntimeError('unexpected path: %r' % path)", "metadata": "root.Context.read", "header": "['class', 'Context', '(', 'LoggingMixIn', ',', 'Operations', ')', ':', '___EOS___']", "index": 121 }, { "content": " def _histories(self):\n cache = self.histories_cache\n now = time.time()\n if cache['contents'] is None or now - cache['time'] > CACHE_TIME:\n cache['time'] = now\n cache['contents'] = self.gi.histories.get_histories()\n return cache['contents']", "metadata": "root.Context._histories", "header": "['class', 'Context', '(', 'LoggingMixIn', ',', 'Operations', ')', ':', '___EOS___']", "index": 125 }, { "content": " def _history(self,h_name):\n (fixed_name, hist_id) = parse_name_with_id(h_name)\n h = filter(lambda x: x['name']==fixed_name, self._histories())\n if len(h)==0:\n raise FuseOSError(ENOENT)\n if len(h)>1:\n h = filter(lambda x: x['id']==hist_id, self._histories())\n if len(h)==0:\n raise FuseOSError(ENOENT)\n if len(h)>1:\n print \"Too many histories with identical names and IDs\"\n return h[0]\n return h[0]", "metadata": "root.Context._history", "header": "['class', 'Context', '(', 'LoggingMixIn', ',', 'Operations', ')', ':', '___EOS___']", "index": 134 }, { "content": " def _datasets(self, h):\n id = h['id']\n cache = self.datasets_cache\n now = time.time()\n if id not in cache or now - cache[id]['time'] > CACHE_TIME:\n cache[id] = {'time':now,\n 'contents':self.gi.histories.show_history(id,contents=True,details='all')}\n return cache[id]['contents']", "metadata": "root.Context._datasets", "header": "['class', 'Context', '(', 'LoggingMixIn', ',', 'Operations', ')', ':', '___EOS___']", "index": 149 }, { "content": " def _dataset(self, kw):\n h = self._history(kw['h_name'])\n ds = self._datasets(h)\n (d_name, d_id) = parse_name_with_id(kw['ds_name'])\n d = filter(lambda x: x['name']==d_name, ds)\n\n if len(d)==0:\n raise FuseOSError(ENOENT)\n if len(d)>1:\n d = filter(lambda x: x['name']==d_name and x['id'] == d_id, ds)\n if len(d)==0:\n raise FuseOSError(ENOENT)\n if len(d)>1:\n print \"Too many datasets with that name and ID\"\n return d[0]\n # Some versions of the Galaxy API use file_path and some file_name\n if 'file_path' not in d[0] and 'file_name' not in d[0]:\n print \"Unable to find file of dataset. Have you set : expose_dataset_path = True\"\n raise FuseOSError(ENOENT)\n return d[0]", "metadata": "root.Context._dataset", "header": "['class', 'Context', '(', 'LoggingMixIn', ',', 'Operations', ')', ':', '___EOS___']", "index": 159 }, { "content": " def readdir(self, path, fh):\n (typ,kw) = path_type(path)\n if typ=='root':\n return ['.', '..', 'histories']\n elif typ=='histories':\n hl = self._histories()\n # Count duplicates\n hist_count = {}\n for h in hl:\n try:\n hist_count[h['name']] += 1\n except:\n hist_count[h['name']] = 1\n # Build up results manually\n results = ['.', '..']\n for h in hl:\n if h['name'] in hist_count and hist_count[h['name']] > 1:\n results.append(esc_filename(h['name'] + '-' + h['id']))\n else:\n results.append(esc_filename(h['name']))\n return results\n elif typ=='datasets':\n h = self._history(kw['h_name'])\n ds = self._datasets(h)\n #print ds\n # Count duplicates\n d_count = {}\n for d in ds:\n try:\n d_count[d['name']] += 1\n except:\n d_count[d['name']] = 1\n results = ['.', '..']\n for d in ds:\n if d['name'] in d_count and d_count[d['name']] > 1:\n results.append(esc_filename(d['name'] + '-' + d['id']))\n else:\n results.append(esc_filename(d['name']))\n return results", "metadata": "root.Context.readdir", "header": "['class', 'Context', '(', 'LoggingMixIn', ',', 'Operations', ')', ':', '___EOS___']", "index": 181 } ]
[ { "span": "from stat import S_IFDIR, S_IFREG, S_IFLNK", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 42 }, { "span": "from sys import argv, exit", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 26 }, { "span": "from fuse import FUSE, FuseOSError, Operations, LoggingMixIn, fuse_get_context", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 78 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "galax", "y", "-", "fuse", ".", "py", " ", "will", " ", "mount", " ", "Gal", "ax", "y", " ", "dataset", "s", " ", "for", " ", "direct", " ", "read", " ", "access", " ", "usi", "ng", " ", "FU", "SE", ".", "\\", "10", ";", "\\", "10", ";", "To", " ", "do", " ", "this", " ", "you", " ", "will", " ", "need", " ", "your", " ", "Gal", "ax", "y", " ", "API", " ", "key", ",", " ", "found", " ", "by", " ", "logg", "ing", " ", "int", "o", " ", "Gal", "ax", "y", " ", "and", "\\", "10", ";", "selecti", "ng", " ", "the", " ", "menu", " ", "option", " ", "User", " ", "->", " ", "API", " ", "Keys", ".", " ", "You", " ", "can", " ", "mount", " ", "your", " ", "Gal", "ax", "y", " ", "dataset", "s", "\\", "10", ";", "usi", "ng", " ", "a", " ", "command", " ", "like", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "python", " ", "galax", "y", "-", "fuse", ".", "py", " ", "<", "api", "-", "key", ">", " ", "&", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "puts", " ", "the", " ", "galax", "y", "-", "fuse", " ", "process", " ", "int", "o", " ", "the", " ", "background", ".", " ", "Gal", "ax", "y", " ", "Datasets", " ", "will", " ", "then", "\\", "10", ";", "appear", " ", "as", " ", "read", "-", "only", " ", "files", ",", " ", "organi", "sed", " ", "by", " ", "Hist", "ory", ",", " ", "under", " ", "the", " ", "director", "y", " ", "galax", "y", "\\u", "files", ".", "\\", "10", ";", "\\", "10", ";", "galax", "y", "-", "fuse", " ", "was", " ", "writt", "en", " ", "by", " ", "Dr", " ", "Dav", "id", " ", "Pow", "ell", " ", "and", " ", "beg", "an", " ", "life", " ", "at", "\\", "10", ";", "https", "://", "git", "hub", ".", "com", "/", "dr", "pow", "ell", "/", "galax", "y", "-", "fuse", " ", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "errno_", "import_", "ENOENT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "stat_", "import_", "S", "\\u", "IF", "DIR_", ",_", "S", "\\u", "IF", "REG_", ",_", "S", "\\u", "IF", "LN", "K_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sys_", "import_", "argv_", ",_", "exit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "fuse", "_", "import_", "FU", "SE_", ",_", "Fus", "e", "OSE", "rror_", ",_", "Operations_", ",_", "Log", "ging", "Mix", "In_", ",_", "fuse", "\\u", "get", "\\u", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "bio", "blend", "_", "import_", "galaxy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "number", " ", "of", " ", "second", "s", " ", "to", " ", "cache", " ", "histo", "ry", "/", "dataset", " ", "lookups", "_", "\\u\\u\\uNL\\u\\u\\u_", "CACHE", "\\u", "TIME_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Split", " ", "a", " ", "path", " ", "int", "o", " ", "hash", " ", "of", " ", "components_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Esc", "ape", "/", "unescape", " ", "slash", "es", " ", "in", " ", "filenames_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Esc", "ape", "/", "unescape", " ", "slash", "es", " ", "in", " ", "filenames_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", "description_", "=_", "\"", "Mount", " ", "Gal", "ax", "y", " ", "Datasets", " ", "for", " ", "direct", " ", "read", " ", "access", " ", "usi", "ng", " ", "FU", "SE", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\"", "api", "key", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Gal", "ax", "y", " ", "API", " ", "key", " ", "for", " ", "the", " ", "account", " ", "to", " ", "read", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\"-", "m", "\"_", ",_", "\"--", "mountpoint", "\"_", ",_", "default_", "=_", "\"", "galax", "y", "\\u", "files", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Director", "y", " ", "under", " ", "whi", "ch", " ", "to", " ", "mount", " ", "the", " ", "Gal", "ax", "y", " ", "Datasets", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "director", "y", " ", "if", " ", "it", " ", "doe", "s", " ", "not", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "args_", "._", "mountpoint_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "args_", "._", "mountpoint_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fuse", "_", "=_", "FU", "SE_", "(_", "Context_", "(_", "args_", "._", "apikey_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "._", "mountpoint_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "foreground_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ro_", "=_", "True_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "path", "\\u", "type_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parts_", "=_", "filter_", "(_", "lambda_", "x_", ":_", "len_", "(_", "x_", ")_", ">_", "0_", ",_", "path_", "._", "split_", "(_", "'/'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "path_", "==_", "'/'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "'", "root", "'_", ",_", "dict_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "path_", "==_", "'/", "histori", "es", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "'", "histori", "es", "'_", ",_", "dict_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "parts_", ")_", "==_", "2_", "and_", "parts_", "[_", "0_", "]_", "==_", "'", "histori", "es", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "'", "dataset", "s", "'_", ",_", "dict_", "(_", "h", "\\u", "name_", "=_", "une", "sc", "\\u", "filename_", "(_", "parts_", "[_", "1_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "parts_", ")_", "==_", "3_", "and_", "parts_", "[_", "0_", "]_", "==_", "'", "histori", "es", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "'", "data", "'_", ",_", "dict_", "(_", "h", "\\u", "name_", "=_", "une", "sc", "\\u", "filename_", "(_", "parts_", "[_", "1_", "]_", ")_", ",_", "ds", "\\u", "name_", "=_", "une", "sc", "\\u", "filename_", "(_", "parts_", "[_", "2_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "Un", "know", "n", " ", ":", " ", "%", "s", "\"_", "%_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "''_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "esc", "\\u", "filename_", "(_", "fname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "esc_", "(_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "m_", "._", "group_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "c_", "==_", "'%'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'%%", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "c_", "==_", "'/'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'%", "-'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "re_", "._", "sub_", "(_", "r", "'%", "|/", "'_", ",_", "esc_", ",_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "une", "sc", "\\u", "filename_", "(_", "fname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "une", "sc_", "(_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "str_", "=_", "m_", "._", "group_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "str_", "==_", "'%%", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'%'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "str_", "==_", "'%", "-'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "re_", "._", "sub_", "(_", "r", "'%", "(.", ")'_", ",_", "une", "sc_", ",_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "name", "\\u", "with", "\\u", "id_", "(_", "fname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "1c", "d8", "e2", "f6", "b1", "3", "1e", "891", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "re_", "._", "match_", "(_", "r", "\"", "^", "(?", "P", "<", "name", ">.*)", "-(", "?", "P", "<", "id", ">[", "0", "-", "9", "a", "-", "f", "]{", "16", "})\"_", ",_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "m_", "._", "group_", "(_", "'", "name", "'_", ")_", ",_", "m_", "._", "group_", "(_", "'", "id", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "fname_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Context_", "(_", "Log", "ging", "Mix", "In_", ",_", "Operations_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'", "Prototype", " ", "FU", "SE", " ", "to", " ", "galax", "y", " ", "histori", "es", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", " ", "a", " ", "symlink", " ", "for", " ", "the", " ", "give", "n", " ", "dataset_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Look", "up", " ", "all", " ", "histori", "es", " ", "in", " ", "galax", "y", ";", " ", "cache_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "a", " ", "specific", " ", "histo", "ry", " ", "by", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Look", "up", " ", "all", " ", "dataset", "s", " ", "in", " ", "the", " ", "specified", " ", "histo", "ry", ";", " ", "cache_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "a", " ", "specific", " ", "dataset", " ", "-", " ", "the", " ", "'", "kw", "'", " ", "parameter", " ", "is", " ", "from", " ", "path", "\\u", "type", "()", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "read", " ", "director", "y", " ", "contents_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Disa", "ble", " ", "unu", "sed", " ", "operati", "ons", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "access_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flush_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "xattr", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "xattr", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opend", "ir_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "release_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "released", "ir_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stat", "fs_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Context_", "(_", "Log", "ging", "Mix", "In_", ",_", "Operations_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "api", "\\u", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "gi_", "=_", "galaxy_", "._", "Gal", "ax", "y", "Instance_", "(_", "url_", "=_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "80", "/", "galax", "y", "/'_", ",_", "key_", "=_", "api", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dataset", "s", "\\u", "cache_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "histori", "es", "\\u", "cache_", "=_", "{_", "'", "time", "'_", ":_", "None_", ",_", "'", "content", "s", "'_", ":_", "None_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Context_", "(_", "Log", "ging", "Mix", "In_", ",_", "Operations_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getattr_", "(_", "self_", ",_", "path_", ",_", "fh_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "uid", ",", " ", "gid", ",", " ", "pid", " ", "=", " ", "fuse", "\\u", "get", "\\u", "context", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "typ_", ",_", "kw_", ")_", "=_", "path", "\\u", "type_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "typ_", "==_", "'", "root", "'_", "or_", "typ_", "==_", "'", "histori", "es", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Simple", " ", "directory_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "st_", "=_", "dict_", "(_", "st", "\\u", "mode_", "=_", "(_", "S", "\\u", "IF", "DIR_", "|_", "0_", "555", "_", ")_", ",_", "st", "\\u", "nli", "nk_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "st_", "[_", "'", "st", "\\u", "ctime", "'_", "]_", "=_", "st_", "[_", "'", "st", "\\u", "mti", "me", "'_", "]_", "=_", "st_", "[_", "'", "st", "\\u", "atime", "'_", "]_", "=_", "now_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "typ_", "==_", "'", "dataset", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Simple", " ", "directory_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "st_", "=_", "dict_", "(_", "st", "\\u", "mode_", "=_", "(_", "S", "\\u", "IF", "DIR_", "|_", "0_", "555", "_", ")_", ",_", "st", "\\u", "nli", "nk_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "st_", "[_", "'", "st", "\\u", "ctime", "'_", "]_", "=_", "st_", "[_", "'", "st", "\\u", "mti", "me", "'_", "]_", "=_", "st_", "[_", "'", "st", "\\u", "atime", "'_", "]_", "=_", "now_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "typ_", "==_", "'", "data", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "A", " ", "file", ",", " ", "will", " ", "be", " ", "a", " ", "symlink", " ", "to", " ", "a", " ", "galax", "y", " ", "dataset_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "self_", "._", "\\u", "dataset_", "(_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "time_", "._", "mktime_", "(_", "time_", "._", "strptime_", "(_", "d_", "[_", "'", "update", "\\u", "time", "'_", "]_", ",_", "'%", "Y", "-%", "m", "-%", "d", "T", "%", "H", ":", "%", "M", ":", "%", "S", ".", "%", "f", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname_", "=_", "esc", "\\u", "filename_", "(_", "d_", "._", "get_", "(_", "'", "file", "\\u", "path", "'_", ",_", "d_", "[_", "'", "file", "\\u", "name", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "st_", "=_", "dict_", "(_", "st", "\\u", "mode_", "=_", "(_", "S", "\\u", "IF", "LN", "K_", "|_", "0_", "444_", ")_", ",_", "st", "\\u", "nli", "nk_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "st", "\\u", "size_", "=_", "len_", "(_", "fname_", ")_", ",_", "st", "\\u", "ctime_", "=_", "t_", ",_", "st", "\\u", "mtime_", "=_", "t_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "st", "\\u", "atime", "_", "=_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "st", " ", "=", " ", "dict", "(", "st", "\\u", "mode", "=(", "S", "\\u", "IF", "REG", " ", "|", " ", "044", "4", "),", " ", "st", "\\u", "nli", "nk", "=", "1", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "st", "\\u", "size", "=", "fname", ",", " ", "st", "\\u", "ctime", "=", "t", ",", " ", "st", "\\u", "mti", "me", "=", "t", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "st", "\\u", "atime", "=", "t", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Fus", "e", "OSE", "rror_", "(_", "ENOENT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "st_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Context_", "(_", "Log", "ging", "Mix", "In_", ",_", "Operations_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "readli", "nk_", "(_", "self_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "typ_", ",_", "kw_", ")_", "=_", "path", "\\u", "type_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "typ_", "==_", "'", "data", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "self_", "._", "\\u", "dataset_", "(_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "have", " ", "alr", "ead", "y", " ", "checke", "d", " ", "tha", "t", " ", "one", " ", "of", " ", "these", " ", "keys", " ", "is", " ", "present_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "d_", "._", "get_", "(_", "'", "file", "\\u", "path", "'_", ",_", "d_", "[_", "'", "file", "\\u", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Fus", "e", "OSE", "rror_", "(_", "ENOENT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Context_", "(_", "Log", "ging", "Mix", "In_", ",_", "Operations_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "path_", ",_", "size_", ",_", "offset_", ",_", "fh_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "'", "unexpected", " ", "path", ":", " ", "%", "r", "'_", "%_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Context_", "(_", "Log", "ging", "Mix", "In_", ",_", "Operations_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "histori", "es_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "=_", "self_", "._", "histori", "es", "\\u", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cache_", "[_", "'", "content", "s", "'_", "]_", "is_", "None_", "or_", "now_", "-_", "cache_", "[_", "'", "time", "'_", "]_", ">_", "CACHE", "\\u", "TIME_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "[_", "'", "time", "'_", "]_", "=_", "now_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache_", "[_", "'", "content", "s", "'_", "]_", "=_", "self_", "._", "gi_", "._", "histori", "es_", "._", "get", "\\u", "histori", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cache_", "[_", "'", "content", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Context_", "(_", "Log", "ging", "Mix", "In_", ",_", "Operations_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "history_", "(_", "self_", ",_", "h", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "fixed", "\\u", "name_", ",_", "hist", "\\u", "id_", ")_", "=_", "parse", "\\u", "name", "\\u", "with", "\\u", "id_", "(_", "h", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "filter_", "(_", "lambda_", "x_", ":_", "x_", "[_", "'", "name", "'_", "]_", "==_", "fixed", "\\u", "name_", ",_", "self_", "._", "\\u", "histori", "es_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "h_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Fus", "e", "OSE", "rror_", "(_", "ENOENT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "h_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "h_", "=_", "filter_", "(_", "lambda_", "x_", ":_", "x_", "[_", "'", "id", "'_", "]_", "==_", "hist", "\\u", "id_", ",_", "self_", "._", "\\u", "histori", "es_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "h_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Fus", "e", "OSE", "rror_", "(_", "ENOENT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "h_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Too", " ", "many", " ", "histori", "es", " ", "with", " ", "identi", "cal", " ", "names", " ", "and", " ", "ID", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "h_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "h_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Context_", "(_", "Log", "ging", "Mix", "In_", ",_", "Operations_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "datasets_", "(_", "self_", ",_", "h_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "id_", "=_", "h_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache_", "=_", "self_", "._", "dataset", "s", "\\u", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "id_", "not_", "in_", "cache_", "or_", "now_", "-_", "cache_", "[_", "id_", "]_", "[_", "'", "time", "'_", "]_", ">_", "CACHE", "\\u", "TIME_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "[_", "id_", "]_", "=_", "{_", "'", "time", "'_", ":_", "now_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "s", "'_", ":_", "self_", "._", "gi_", "._", "histori", "es_", "._", "show", "\\u", "history_", "(_", "id_", ",_", "contents_", "=_", "True_", ",_", "details_", "=_", "'", "all", "'_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cache_", "[_", "id_", "]_", "[_", "'", "content", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Context_", "(_", "Log", "ging", "Mix", "In_", ",_", "Operations_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "dataset_", "(_", "self_", ",_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "h_", "=_", "self_", "._", "\\u", "history_", "(_", "kw_", "[_", "'", "h", "\\u", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ds_", "=_", "self_", "._", "\\u", "datasets_", "(_", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "d\\u", "name_", ",_", "d\\u", "id_", ")_", "=_", "parse", "\\u", "name", "\\u", "with", "\\u", "id_", "(_", "kw_", "[_", "'", "ds", "\\u", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "filter_", "(_", "lambda_", "x_", ":_", "x_", "[_", "'", "name", "'_", "]_", "==_", "d\\u", "name_", ",_", "ds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "d_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Fus", "e", "OSE", "rror_", "(_", "ENOENT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "d_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "filter_", "(_", "lambda_", "x_", ":_", "x_", "[_", "'", "name", "'_", "]_", "==_", "d\\u", "name_", "and_", "x_", "[_", "'", "id", "'_", "]_", "==_", "d\\u", "id_", ",_", "ds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "d_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Fus", "e", "OSE", "rror_", "(_", "ENOENT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "d_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Too", " ", "many", " ", "dataset", "s", " ", "with", " ", "tha", "t", " ", "name", " ", "and", " ", "ID", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "d_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Some", " ", "version", "s", " ", "of", " ", "the", " ", "Gal", "ax", "y", " ", "API", " ", "use", " ", "file", "\\u", "path", " ", "and", " ", "some", " ", "file", "\\u", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "file", "\\u", "path", "'_", "not_", "in_", "d_", "[_", "0_", "]_", "and_", "'", "file", "\\u", "name", "'_", "not_", "in_", "d_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Una", "ble", " ", "to", " ", "find", " ", "file", " ", "of", " ", "dataset", ".", " ", " ", "Ha", "ve", " ", "you", " ", "set", " ", ":", " ", "expos", "e\\u", "dataset", "\\u", "path", " ", "=", " ", "Tru", "e", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Fus", "e", "OSE", "rror_", "(_", "ENOENT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "d_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Context_", "(_", "Log", "ging", "Mix", "In_", ",_", "Operations_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "dir_", "(_", "self_", ",_", "path_", ",_", "fh_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "typ_", ",_", "kw_", ")_", "=_", "path", "\\u", "type_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "typ_", "==_", "'", "root", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "'.'_", ",_", "'..'_", ",_", "'", "histori", "es", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "typ_", "==_", "'", "histori", "es", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hl_", "=_", "self_", "._", "\\u", "histori", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Count", " ", "duplicates_", "\\u\\u\\uNL\\u\\u\\u_", "hist", "\\u", "count_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "h_", "in_", "hl_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "hist", "\\u", "count_", "[_", "h_", "[_", "'", "name", "'_", "]_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "hist", "\\u", "count_", "[_", "h_", "[_", "'", "name", "'_", "]_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Build", " ", "up", " ", "results", " ", "manu", "ally", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "[_", "'.'_", ",_", "'..'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "h_", "in_", "hl_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "h_", "[_", "'", "name", "'_", "]_", "in_", "hist", "\\u", "count_", "and_", "hist", "\\u", "count_", "[_", "h_", "[_", "'", "name", "'_", "]_", "]_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "results_", "._", "append_", "(_", "esc", "\\u", "filename_", "(_", "h_", "[_", "'", "name", "'_", "]_", "+_", "'-'_", "+_", "h_", "[_", "'", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "results_", "._", "append_", "(_", "esc", "\\u", "filename_", "(_", "h_", "[_", "'", "name", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "typ_", "==_", "'", "dataset", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "h_", "=_", "self_", "._", "\\u", "history_", "(_", "kw_", "[_", "'", "h", "\\u", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ds_", "=_", "self_", "._", "\\u", "datasets_", "(_", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "ds_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Count", " ", "duplicates_", "\\u\\u\\uNL\\u\\u\\u_", "d\\u", "count_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "d_", "in_", "ds_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "d\\u", "count_", "[_", "d_", "[_", "'", "name", "'_", "]_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "d\\u", "count_", "[_", "d_", "[_", "'", "name", "'_", "]_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "[_", "'.'_", ",_", "'..'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "d_", "in_", "ds_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "d_", "[_", "'", "name", "'_", "]_", "in_", "d\\u", "count_", "and_", "d\\u", "count_", "[_", "d_", "[_", "'", "name", "'_", "]_", "]_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "results_", "._", "append_", "(_", "esc", "\\u", "filename_", "(_", "d_", "[_", "'", "name", "'_", "]_", "+_", "'-'_", "+_", "d_", "[_", "'", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "results_", "._", "append_", "(_", "esc", "\\u", "filename_", "(_", "d_", "[_", "'", "name", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "results_", "\\u\\u\\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TestInner(self, method, port, curl_config_fn, read_timeout):\n for response_code in [http.HTTP_OK, http.HttpNotFound.code,\n http.HTTP_NOT_MODIFIED]:\n for response_body in [None, \"Hello World\",\n \"Very Long\\tContent here\\n\" * 171]:\n for errmsg in [None, \"error\"]:\n req = http.client.HttpClientRequest(\"localhost\", port, method,\n \"/version\",\n curl_config_fn=curl_config_fn,\n read_timeout=read_timeout)\n curl = _FakeCurl()\n pending = http.client._StartRequest(curl, req)\n self.assertEqual(pending.GetCurlHandle(), curl)\n self.assertEqual(pending.GetCurrentRequest(), req)\n\n # Check options\n opts = curl.opts\n self.assertEqual(opts.pop(pycurl.CUSTOMREQUEST), method)\n self.assertEqual(opts.pop(pycurl.URL),\n \"https://localhost:%s/version\" % port)\n if read_timeout is None:\n self.assertEqual(opts.pop(pycurl.TIMEOUT), 0)\n else:\n self.assertEqual(opts.pop(pycurl.TIMEOUT), read_timeout)\n self.assertFalse(opts.pop(pycurl.VERBOSE))\n self.assertTrue(opts.pop(pycurl.NOSIGNAL))\n self.assertEqual(opts.pop(pycurl.USERAGENT),\n http.HTTP_GANETI_VERSION)\n self.assertEqual(opts.pop(pycurl.PROXY), \"\")\n self.assertFalse(opts.pop(pycurl.POSTFIELDS))\n self.assertFalse(opts.pop(pycurl.HTTPHEADER))\n write_fn = opts.pop(pycurl.WRITEFUNCTION)\n self.assertTrue(callable(write_fn))\n if hasattr(pycurl, \"SSL_SESSIONID_CACHE\"):\n self.assertFalse(opts.pop(pycurl.SSL_SESSIONID_CACHE))\n if curl_config_fn:\n self.assertEqual(opts.pop(pycurl.SSLKEYTYPE), \"PEM\")\n else:\n self.assertFalse(pycurl.SSLKEYTYPE in opts)\n self.assertFalse(opts)\n\n if response_body is not None:\n offset = 0\n while offset < len(response_body):\n piece = response_body[offset:offset + 10]\n write_fn(piece)\n offset += len(piece)\n\n curl.info = {\n pycurl.RESPONSE_CODE: response_code,\n }\n if hasattr(pycurl, 'LOCAL_IP'):\n curl.info[pycurl.LOCAL_IP] = '127.0.0.1'\n if hasattr(pycurl, 'LOCAL_PORT'):\n curl.info[pycurl.LOCAL_PORT] = port\n\n # Finalize request\n pending.Done(errmsg)\n\n self.assertFalse(curl.info)\n\n # Can only finalize once\n self.assertRaises(AssertionError, pending.Done, True)\n\n if errmsg:\n self.assertFalse(req.success)\n else:\n self.assertTrue(req.success)\n self.assertEqual(req.error, errmsg)\n self.assertEqual(req.resp_status_code, response_code)\n if response_body is None:\n self.assertEqual(req.resp_body, \"\")\n else:\n self.assertEqual(req.resp_body, response_body)\n\n # Check if resetting worked\n assert not hasattr(curl, \"reset\")\n opts = curl.opts\n self.assertFalse(opts.pop(pycurl.POSTFIELDS))\n self.assertTrue(callable(opts.pop(pycurl.WRITEFUNCTION)))\n self.assertFalse(opts)\n\n self.assertFalse(curl.opts,\n msg=\"Previous checks did not consume all options\")\n assert id(opts) == id(curl.opts)", "metadata": "root.TestClientStartRequest._TestInner", "header": "['class', 'TestClientStartRequest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 446 }, { "content": " def test(self):\n requests = [_FakeCurl() for _ in range(10)]\n multi = self._FakeCurlMulti()\n for (curl, errmsg) in http.client._ProcessCurlRequests(multi, requests):\n self.assertTrue(curl not in multi.handles)\n if curl in multi.will_fail:\n self.assertTrue(\"test error\" in errmsg)\n else:\n self.assertTrue(errmsg is None)\n self.assertFalse(multi.handles)\n self.assertEqual(multi._expect, [\"select\"])", "metadata": "root.TestProcessCurlRequests.test", "header": "['class', 'TestProcessCurlRequests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 628 }, { "content": " def _Test(self, use_monitor):\n def cfg_fn(port, curl):\n curl.opts[\"__port__\"] = port\n\n def _LockCheckReset(monitor, req):\n self.assertTrue(monitor._lock.is_owned(shared=0),\n msg=\"Lock must be owned in exclusive mode\")\n assert not hasattr(req, \"lockcheck__\")\n setattr(req, \"lockcheck__\", True)\n\n def _BuildNiceName(port, default=None):\n if port % 5 == 0:\n return \"nicename%s\" % port\n else:\n # Use standard name\n return default\n\n requests = \\\n [http.client.HttpClientRequest(\"localhost\", i, \"POST\", \"/version%s\" % i,\n curl_config_fn=compat.partial(cfg_fn, i),\n completion_cb=NotImplementedError,\n nicename=_BuildNiceName(i))\n for i in range(15176, 15501)]\n requests_count = len(requests)\n\n if use_monitor:\n lock_monitor_cb = self._MonitorChecker()\n else:\n lock_monitor_cb = None\n\n def _ProcessRequests(multi, handles):\n self.assertTrue(isinstance(multi, self._DummyCurlMulti))\n self.assertEqual(len(requests), len(handles))\n self.assertTrue(compat.all(isinstance(curl, _FakeCurl)\n for curl in handles))\n\n # Prepare for lock check\n for req in requests:\n assert req.completion_cb is NotImplementedError\n if use_monitor:\n req.completion_cb = \\\n compat.partial(_LockCheckReset, lock_monitor_cb.GetMonitor())\n\n for idx, curl in enumerate(handles):\n try:\n port = curl.opts[\"__port__\"]\n except KeyError:\n self.fail(\"Per-request config function was not called\")\n\n if use_monitor:\n # Check if lock information is correct\n lock_info = lock_monitor_cb.GetMonitor().GetLockInfo(None)\n expected = \\\n [(\"rpc/%s\" % (_BuildNiceName(handle.opts[\"__port__\"],\n default=(\"localhost/version%s\" %\n handle.opts[\"__port__\"]))),\n None,\n [threading.currentThread().getName()], None)\n for handle in handles[idx:]]\n self.assertEqual(sorted(lock_info), sorted(expected))\n\n if port % 3 == 0:\n response_code = http.HTTP_OK\n msg = None\n else:\n response_code = http.HttpNotFound.code\n msg = \"test error\"\n\n curl.info = {\n pycurl.RESPONSE_CODE: response_code,\n }\n if hasattr(pycurl, 'LOCAL_IP'):\n curl.info[pycurl.LOCAL_IP] = '127.0.0.1'\n if hasattr(pycurl, 'LOCAL_PORT'):\n curl.info[pycurl.LOCAL_PORT] = port\n\n # Prepare for reset\n self.assertFalse(curl.opts.pop(pycurl.POSTFIELDS))\n self.assertTrue(callable(curl.opts.pop(pycurl.WRITEFUNCTION)))\n\n yield (curl, msg)\n\n if use_monitor:\n self.assertTrue(compat.all(req.lockcheck__ for req in requests))\n\n if use_monitor:\n self.assertEqual(lock_monitor_cb.GetMonitor(), None)\n\n http.client.ProcessRequests(requests, lock_monitor_cb=lock_monitor_cb,\n _curl=_FakeCurl,\n _curl_multi=self._DummyCurlMulti,\n _curl_process=_ProcessRequests)\n for req in requests:\n if req.port % 3 == 0:\n self.assertTrue(req.success)\n self.assertEqual(req.error, None)\n else:\n self.assertFalse(req.success)\n self.assertTrue(\"test error\" in req.error)\n\n # See if monitor was disabled\n if use_monitor:\n monitor = lock_monitor_cb.GetMonitor()\n self.assertEqual(monitor._pending_fn, None)\n self.assertEqual(monitor.GetLockInfo(None), [])\n else:\n self.assertEqual(lock_monitor_cb, None)\n\n self.assertEqual(len(requests), requests_count)", "metadata": "root.TestProcessRequests._Test", "header": "['class', 'TestProcessRequests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 662 } ]
[ { "span": "self.assertFalse(pycurl.SSLKEYTYPE in opts)", "start_line": 484, "start_column": 12, "end_line": 484, "end_column": 55 }, { "span": "self.assertTrue(curl not in multi.handles)", "start_line": 632, "start_column": 6, "end_line": 632, "end_column": 48 }, { "span": "self.assertTrue(\"test error\" in errmsg)", "start_line": 634, "start_column": 8, "end_line": 634, "end_column": 47 }, { "span": "self.assertTrue(errmsg is None)", "start_line": 636, "start_column": 8, "end_line": 636, "end_column": 39 }, { "span": "self.assertTrue(\"test error\" in req.error)", "start_line": 760, "start_column": 8, "end_line": 760, "end_column": 50 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Client", "Start", "Request_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Test", "In", "ner_", "(_", "self_", ",_", "method_", ",_", "port_", ",_", "curl", "\\u", "config", "\\u", "fn_", ",_", "read", "\\u", "timeout_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "response", "\\u", "code_", "in_", "[_", "http_", "._", "HTTP", "\\u", "OK_", ",_", "http_", "._", "Http", "Not", "Found_", "._", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "http_", "._", "HTTP", "\\u", "NOT", "\\u", "MODIFIE", "D_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "response", "\\u", "body_", "in_", "[_", "None_", ",_", "\"", "Hell", "o", " ", "Wor", "ld", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ver", "y", " ", "Long", "\\\\", "t", "Conten", "t", " ", "here", "\\\\", "n", "\"_", "*_", "171_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "errmsg_", "in_", "[_", "None_", ",_", "\"", "error", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "http_", "._", "client_", "._", "Http", "Client", "Request_", "(_", "\"", "local", "host", "\"_", ",_", "port_", ",_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "version", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "curl", "\\u", "config", "\\u", "fn_", "=_", "curl", "\\u", "config", "\\u", "fn_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "read", "\\u", "timeout_", "=_", "read", "\\u", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curl_", "=_", "\\u", "Fake", "Curl", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pending_", "=_", "http_", "._", "client_", "._", "\\u", "Start", "Request_", "(_", "curl_", ",_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "pending_", "._", "Get", "Curl", "Handle_", "(_", ")_", ",_", "curl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "pending_", "._", "Get", "Curr", "ent", "Request_", "(_", ")_", ",_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "options_", "\\u\\u\\uNL\\u\\u\\u_", "opts_", "=_", "curl_", "._", "opts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "CUSTOM", "REQUEST_", ")_", ",_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "URL_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "https", "://", "local", "host", ":", "%", "s", "/", "version", "\"_", "%_", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "read", "\\u", "timeout_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "TIMEOUT_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "TIMEOUT_", ")_", ",_", "read", "\\u", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "VERBOSE_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "NOS", "IGN", "AL_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "USER", "AGENT_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "http_", "._", "HTTP", "\\u", "GAN", "ETI", "\\u", "VERSION_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "PROX", "Y_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "POST", "FIELDS_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "HTTP", "HEADER_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write", "\\u", "fn_", "=_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "WRITE", "FUNCTION_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "callable_", "(_", "write", "\\u", "fn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "pycurl_", ",_", "\"", "SS", "L", "\\u", "SES", "SION", "ID", "\\u", "CACHE", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "False_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "SS", "L", "\\u", "SES", "SION", "ID", "\\u", "CACHE_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "curl", "\\u", "config", "\\u", "fn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "SS", "LK", "EY", "TYPE_", ")_", ",_", "\"", "PEM", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "False_", "(_", "pycurl_", "._", "SS", "LK", "EY", "TYPE_", "in_", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "response", "\\u", "body_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "offset_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "offset_", "<_", "len_", "(_", "response", "\\u", "body_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "piece_", "=_", "response", "\\u", "body_", "[_", "offset_", ":_", "offset_", "+_", "10_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write", "\\u", "fn_", "(_", "piece_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", "+=_", "len_", "(_", "piece_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "curl_", "._", "info_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "pycurl_", "._", "RESPONSE", "\\u", "CODE_", ":_", "response", "\\u", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "pycurl_", ",_", "'", "LOCAL", "\\u", "IP", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "curl_", "._", "info_", "[_", "pycurl_", "._", "LOCAL", "\\u", "IP_", "]_", "=_", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "pycurl_", ",_", "'", "LOCAL", "\\u", "PORT", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "curl_", "._", "info_", "[_", "pycurl_", "._", "LOCAL", "\\u", "PORT_", "]_", "=_", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Finali", "ze", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pending_", "._", "Done_", "(_", "errmsg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "curl_", "._", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Can", " ", "only", " ", "finalize", " ", "once_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Assert", "ion", "Error_", ",_", "pending_", "._", "Done_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "errmsg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "False_", "(_", "req_", "._", "success_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "req_", "._", "success_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "req_", "._", "error_", ",_", "errmsg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "req_", "._", "resp", "\\u", "status", "\\u", "code_", ",_", "response", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "response", "\\u", "body_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "req_", "._", "resp", "\\u", "body_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "req_", "._", "resp", "\\u", "body_", ",_", "response", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "reset", "ting", " ", "worked", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "not_", "hasattr_", "(_", "curl_", ",_", "\"", "reset", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "=_", "curl_", "._", "opts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "POST", "FIELDS_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "callable_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "WRITE", "FUNCTION_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "curl_", "._", "opts_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\"", "Prev", "ious", " ", "checks", " ", "did", " ", "not", " ", "consume", " ", "all", " ", "options", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "id_", "(_", "opts_", ")_", "==_", "id_", "(_", "curl_", "._", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Process", "Curl", "Requests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "requests_", "=_", "[_", "\\u", "Fake", "Curl", "_", "(_", ")_", "for_", "\\u_", "in_", "range_", "(_", "10_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "multi_", "=_", "self_", "._", "\\u", "Fake", "Curl", "Multi", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "curl_", ",_", "errmsg_", ")_", "in_", "http_", "._", "client_", "._", "\\u", "Process", "Curl", "Requests_", "(_", "multi_", ",_", "requests_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "curl_", "not_", "in_", "multi_", "._", "handles_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "curl_", "in_", "multi_", "._", "will", "\\u", "fail_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "\"", "test", " ", "error", "\"_", "in_", "errmsg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "errmsg_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "multi_", "._", "handles_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "multi_", "._", "\\u", "expect_", ",_", "[_", "\"", "select", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Process", "Requests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Test_", "(_", "self_", ",_", "use", "\\u", "monitor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "cfg", "\\u", "fn_", "(_", "port_", ",_", "curl_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "curl_", "._", "opts_", "[_", "\"\\u\\u", "port", "\\u\\u\"_", "]_", "=_", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Lock", "Check", "Reset_", "(_", "monitor_", ",_", "req_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "monitor_", "._", "\\u", "lock_", "._", "is", "\\u", "owned", "_", "(_", "shared_", "=_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\"", "Lock", " ", "must", " ", "be", " ", "owned", " ", "in", " ", "exclu", "sive", " ", "mode", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "hasattr_", "(_", "req_", ",_", "\"", "lock", "check", "\\u\\u\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "req_", ",_", "\"", "lock", "check", "\\u\\u\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Build", "Nic", "e", "Name_", "(_", "port_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "port_", "%_", "5_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "nice", "name", "%", "s", "\"_", "%_", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Us", "e", " ", "standard", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "requests_", "=_", "[_", "http_", "._", "client_", "._", "Http", "Client", "Request_", "(_", "\"", "local", "host", "\"_", ",_", "i_", ",_", "\"", "POST", "\"_", ",_", "\"/", "version", "%", "s", "\"_", "%_", "i_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "curl", "\\u", "config", "\\u", "fn_", "=_", "compat_", "._", "partial_", "(_", "cfg", "\\u", "fn_", ",_", "i_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "completion", "\\u", "cb_", "=_", "Not", "Impl", "ement", "ed", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nice", "name_", "=_", "\\u", "Build", "Nic", "e", "Name_", "(_", "i_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "151", "76_", ",_", "155", "01_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request", "s", "\\u", "count_", "=_", "len_", "(_", "requests_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "use", "\\u", "monitor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lock", "\\u", "monit", "or", "\\u", "cb_", "=_", "self_", "._", "\\u", "Monitor", "Checker_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lock", "\\u", "monit", "or", "\\u", "cb_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Process", "Requests_", "(_", "multi_", ",_", "handles_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "multi_", ",_", "self_", "._", "\\u", "Du", "mm", "y", "Curl", "Multi", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "requests_", ")_", ",_", "len_", "(_", "handles_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "compat_", "._", "all_", "(_", "isinstance_", "(_", "curl_", ",_", "\\u", "Fake", "Curl", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "curl_", "in_", "handles_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Prepare", " ", "for", " ", "lock", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "req_", "in_", "requests_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "req_", "._", "completion", "\\u", "cb_", "is_", "Not", "Impl", "ement", "ed", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "use", "\\u", "monitor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "._", "completion", "\\u", "cb_", "=_", "compat_", "._", "partial_", "(_", "\\u", "Lock", "Check", "Reset_", ",_", "lock", "\\u", "monit", "or", "\\u", "cb_", "._", "Get", "Monitor_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "idx_", ",_", "curl_", "in_", "enumerate_", "(_", "handles_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port_", "=_", "curl_", "._", "opts_", "[_", "\"\\u\\u", "port", "\\u\\u\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "Per", "-", "request", " ", "config", " ", "function", " ", "was", " ", "not", " ", "call", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "use", "\\u", "monitor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "lock", " ", "informati", "on", " ", "is", " ", "correct_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lock", "\\u", "info_", "=_", "lock", "\\u", "monit", "or", "\\u", "cb_", "._", "Get", "Monitor_", "(_", ")_", "._", "Get", "Lock", "Info_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "[_", "(_", "\"", "rpc", "/", "%", "s", "\"_", "%_", "(_", "\\u", "Build", "Nic", "e", "Name_", "(_", "handle_", "._", "opts_", "[_", "\"\\u\\u", "port", "\\u\\u\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "(_", "\"", "local", "host", "/", "version", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "handle_", "._", "opts_", "[_", "\"\\u\\u", "port", "\\u\\u\"_", "]_", ")_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "threading_", "._", "current", "Thread_", "(_", ")_", "._", "get", "Name_", "(_", ")_", "]_", ",_", "None_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "handle_", "in_", "handles_", "[_", "idx_", ":_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sorted_", "(_", "lock", "\\u", "info_", ")_", ",_", "sorted_", "(_", "expected_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "port_", "%_", "3_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "code_", "=_", "http_", "._", "HTTP", "\\u", "OK_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "code_", "=_", "http_", "._", "Http", "Not", "Found_", "._", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "\"", "test", " ", "error", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "curl_", "._", "info_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "pycurl_", "._", "RESPONSE", "\\u", "CODE_", ":_", "response", "\\u", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "pycurl_", ",_", "'", "LOCAL", "\\u", "IP", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "curl_", "._", "info_", "[_", "pycurl_", "._", "LOCAL", "\\u", "IP_", "]_", "=_", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "pycurl_", ",_", "'", "LOCAL", "\\u", "PORT", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "curl_", "._", "info_", "[_", "pycurl_", "._", "LOCAL", "\\u", "PORT_", "]_", "=_", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Prepare", " ", "for", " ", "reset_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "curl_", "._", "opts_", "._", "pop_", "(_", "pycurl_", "._", "POST", "FIELDS_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "callable_", "(_", "curl_", "._", "opts_", "._", "pop_", "(_", "pycurl_", "._", "WRITE", "FUNCTION_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "(_", "curl_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "use", "\\u", "monitor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "compat_", "._", "all_", "(_", "req_", "._", "lock", "check", "\\u\\u_", "for_", "req_", "in_", "requests_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "use", "\\u", "monitor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "lock", "\\u", "monit", "or", "\\u", "cb_", "._", "Get", "Monitor_", "(_", ")_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "http_", "._", "client_", "._", "Process", "Requests_", "(_", "requests_", ",_", "lock", "\\u", "monit", "or", "\\u", "cb_", "=_", "lock", "\\u", "monit", "or", "\\u", "cb_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "curl_", "=_", "\\u", "Fake", "Curl", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "curl", "\\u", "multi_", "=_", "self_", "._", "\\u", "Du", "mm", "y", "Curl", "Multi", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "curl", "\\u", "process_", "=_", "\\u", "Process", "Requests_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "req_", "in_", "requests_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "req_", "._", "port_", "%_", "3_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "req_", "._", "success_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "req_", "._", "error_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "False_", "(_", "req_", "._", "success_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "test", " ", "error", "\"_", "in_", "req_", "._", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "if", " ", "monit", "or", " ", "was", " ", "disabled_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "use", "\\u", "monitor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "monitor_", "=_", "lock", "\\u", "monit", "or", "\\u", "cb_", "._", "Get", "Monitor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "monitor_", "._", "\\u", "pend", "ing", "\\u", "fn_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "monitor_", "._", "Get", "Lock", "Info_", "(_", "None_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "lock", "\\u", "monit", "or", "\\u", "cb_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "requests_", ")_", ",_", "request", "s", "\\u", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
tweetdeck/txAMQP/src/txamqp/xmlutil.py
[ { "content": " def get_bool(self, key, default = False):\n v = self.get(key)\n if v == None:\n return default\n else:\n return bool(int(v))", "metadata": "root.Node.get_bool", "header": "['class', 'Node', '(', 'object', ')', ':', '___EOS___']", "index": 47 }, { "content": " def path(self):\n if self.parent == None:\n return \"/%s\" % self.name\n else:\n return \"%s/%s\" % (self.parent.path(), self.name)", "metadata": "root.Node.path", "header": "['class', 'Node', '(', 'object', ')', ':', '___EOS___']", "index": 98 }, { "content": " def characters(self, content):\n if self.node.text == None:\n self.node.text = content\n else:\n self.node.text += content", "metadata": "root.Builder.characters", "header": "['class', 'Builder', '(', 'ContentHandler', ')', ':', '___EOS___']", "index": 118 } ]
[ { "span": "v == None:", "start_line": 49, "start_column": 7, "end_line": 49, "end_column": 16 }, { "span": "self.parent == None:", "start_line": 99, "start_column": 7, "end_line": 99, "end_column": 26 }, { "span": "self.node.text == None:", "start_line": 119, "start_column": 7, "end_line": 119, "end_column": 29 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Node_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "bool_", "(_", "self_", ",_", "key_", ",_", "default_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "self_", "._", "get_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "v_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "bool_", "(_", "int_", "(_", "v_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "parent_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"/%", "s", "\"_", "%_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "self_", "._", "parent_", "._", "path_", "(_", ")_", ",_", "self_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Builder_", "(_", "Conten", "t", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "characters_", "(_", "self_", ",_", "content_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "node_", "._", "text_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "node_", "._", "text_", "=_", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "node_", "._", "text_", "+=_", "content_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
robmoggach/python-moshion/gomoshion.py
[ { "content": "def interactive():\n opts={}\n # INPUT SEQUENCE\n print hilite(\"\\nEnter the input sequence path:\",6)\n print \"\\nEg. /my/great/sequence.%04d.jpg\\n\"\n inseq_input = raw_input(hilite(\"input_path > \",16))\n inseqs=sequence.glob(inseq_input.split('.')[0])\n if len(inseqs) > 1:\n print hilite(\"\\nPick a sequence:\",6)\n for k,v in enumerate(inseqs):\n print \"\\t {0}) {1}\".format(k+1, v)\n inseq_input = raw_input(hilite(\"input_seq (1) > \",16)) or 1\n inseq = inseqs[int(inseq_input)-1] \n else:\n inseq = inseqs[0]\n inseq_path = inseq.__str__().split(' ')[0]\n inseq_start = inseq.__str__().split(' ')[1]\n inseq_end = inseq.__str__().split(' ')[2]\n print hilite(\"\\nEnter first frame of input sequence:\",6)\n print \"\\nEg. 953\\n\"\n start=raw_input(hilite(\"first_fr ({0}) > \".format(inseq_start),16)) or inseq_start\n print hilite(\"\\nEnter last frame of input sequence:\",6)\n print \"\\nEg. 1002\\n\"\n end=raw_input(hilite(\"last_fr ({0}) > \".format(inseq_end),16)) or inseq_end\n # MOSH SEQUENCE\n print hilite(\"\\nEnter the moshtex sequence path:\",6)\n print \"\\nEg. /my/great/moshtex.%04d.jpg\\n\"\n moshseq_input = raw_input(hilite(\"moshtex_path > \", 16))\n moshseqs=sequence.glob(moshseq_input.split('.')[0])\n if len(moshseqs) > 1:\n print \"Pick a sequence:\"\n for k,v in enumerate(moshseqs):\n print \" {0}) {1}\".format(k+1, v)\n moshseq_input = raw_input(hilite(\"moshtex_path > \",16)) or 1\n moshseq = moshseqs[int(moshseq_input)-1] \n else:\n moshseq = moshseqs[0]\n moshseq_path = moshseq.__str__().split(' ')[0]\n moshseq_start = moshseq.__str__().split(' ')[1]\n moshseq_end = moshseq.__str__().split(' ')[2]\n print hilite(\"\\nEnter the first frame of moshtex sequence:\",6)\n print \"\\nEg. 5\\n\"\n moshfirst=raw_input(hilite(\"moshtex_first_fr ({0}) > \".format(moshseq_start),16)) or moshseq_start\n # OUTPUT\n print hilite(\"\\nEnter the output directory path:\",6)\n print \"\\nEg. /my/great/output\\n\"\n outdir = raw_input(hilite(\"output_path > \",16))\n\n bitrate = raw_input(hilite(\"Bitrate (8000) > \",16)) or \"8000\"\n keyframe = raw_input(hilite(\"Keyframe (999) > \",16)) or \"999\"\n threshold = raw_input(hilite(\"Threshold (100000000) > \",16)) or \"100000000\" \n interval = raw_input(hilite(\"Interval (9) > \",16)) or \"9\" \n uber = raw_input(hilite(\"Uber Moshion? (N) > \",12)) or \"N\"\n if uber in ['Y','y','yes','YES','Yes']:\n uber = True\n else:\n uber = False\n return {\n 'inseq': inseq_path,\n 'start': start,\n 'end': end,\n 'moshseq': moshseq_path,\n 'moshstart': moshfirst,\n 'outdir': outdir,\n 'bitrate': bitrate,\n 'keyframe': keyframe,\n 'threshold': threshold,\n 'interval': interval,\n 'uber': uber\n }", "metadata": "root.interactive", "header": "['module', '___EOS___']", "index": 22 } ]
[ { "span": "opts=", "start_line": 23, "start_column": 2, "end_line": 23, "end_column": 6 }, { "span": "moshseq_end ", "start_line": 61, "start_column": 2, "end_line": 61, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "interactive_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opts_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "INPUT", " ", "SEQUENCE", "_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "hil", "ite_", "(_", "\"\\\\", "n", "Enter", " ", "the", " ", "input", " ", "sequence", " ", "path", ":\"_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "n", "Eg", ".", " ", "/", "my", "/", "great", "/", "sequence", ".", "%", "04", "d", ".", "jp", "g", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inse", "q", "\\u", "input_", "=_", "raw", "\\u", "input_", "(_", "hil", "ite_", "(_", "\"", "input", "\\u", "path", " ", ">", " ", " ", "\"_", ",_", "16_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inse", "qs_", "=_", "sequence_", "._", "glob_", "(_", "inse", "q", "\\u", "input_", "._", "split_", "(_", "'.'_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "inse", "qs_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "hil", "ite_", "(_", "\"\\\\", "n", "Pick", " ", "a", " ", "sequence", ":\"_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "enumerate_", "(_", "inse", "qs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\\\\", "t", " ", "{", "0", "})", " ", "{", "1", "}\"_", "._", "format_", "(_", "k_", "+_", "1_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "inse", "q", "\\u", "input_", "=_", "raw", "\\u", "input_", "(_", "hil", "ite_", "(_", "\"", "input", "\\u", "seq", " ", "(", "1", ")", " ", ">", " ", "\"_", ",_", "16_", ")_", ")_", "or_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inse", "q_", "=_", "inse", "qs_", "[_", "int_", "(_", "inse", "q", "\\u", "input_", ")_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inse", "q_", "=_", "inse", "qs_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "inse", "q", "\\u", "path_", "=_", "inse", "q_", "._", "\\u\\u", "str\\u\\u_", "(_", ")_", "._", "split_", "(_", "'", " ", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inse", "q", "\\u", "start_", "=_", "inse", "q_", "._", "\\u\\u", "str\\u\\u_", "(_", ")_", "._", "split_", "(_", "'", " ", "'_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inse", "q", "\\u", "end_", "=_", "inse", "q_", "._", "\\u\\u", "str\\u\\u_", "(_", ")_", "._", "split_", "(_", "'", " ", "'_", ")_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "hil", "ite_", "(_", "\"\\\\", "n", "Enter", " ", "first", " ", "frame", " ", "of", " ", "input", " ", "sequence", ":\"_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "n", "Eg", ".", " ", "953", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "raw", "\\u", "input_", "(_", "hil", "ite_", "(_", "\"", "first", "\\u", "fr", " ", "({", "0", "})", " ", ">", " ", " ", "\"_", "._", "format_", "(_", "inse", "q", "\\u", "start_", ")_", ",_", "16_", ")_", ")_", "or_", "inse", "q", "\\u", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "hil", "ite_", "(_", "\"\\\\", "n", "Enter", " ", "last", " ", "frame", " ", "of", " ", "input", " ", "sequence", ":\"_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "n", "Eg", ".", " ", "1002", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "=_", "raw", "\\u", "input_", "(_", "hil", "ite_", "(_", "\"", "last", "\\u", "fr", " ", "({", "0", "})", " ", ">", " ", " ", "\"_", "._", "format_", "(_", "inse", "q", "\\u", "end_", ")_", ",_", "16_", ")_", ")_", "or_", "inse", "q", "\\u", "end_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "MOS", "H", " ", "SEQUENCE", "_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "hil", "ite_", "(_", "\"\\\\", "n", "Enter", " ", "the", " ", "mos", "hte", "x", " ", "sequence", " ", "path", ":\"_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "n", "Eg", ".", " ", "/", "my", "/", "great", "/", "mos", "hte", "x", ".", "%", "04", "d", ".", "jp", "g", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mos", "hse", "q", "\\u", "input_", "=_", "raw", "\\u", "input_", "(_", "hil", "ite_", "(_", "\"", "mos", "hte", "x", "\\u", "path", " ", ">", " ", " ", "\"_", ",_", "16_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mos", "hse", "qs_", "=_", "sequence_", "._", "glob_", "(_", "mos", "hse", "q", "\\u", "input_", "._", "split_", "(_", "'.'_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "mos", "hse", "qs_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Pick", " ", "a", " ", "sequence", ":\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "enumerate_", "(_", "mos", "hse", "qs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", "{", "0", "})", " ", "{", "1", "}\"_", "._", "format_", "(_", "k_", "+_", "1_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mos", "hse", "q", "\\u", "input_", "=_", "raw", "\\u", "input_", "(_", "hil", "ite_", "(_", "\"", "mos", "hte", "x", "\\u", "path", " ", ">", " ", "\"_", ",_", "16_", ")_", ")_", "or_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mos", "hse", "q_", "=_", "mos", "hse", "qs_", "[_", "int_", "(_", "mos", "hse", "q", "\\u", "input_", ")_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mos", "hse", "q_", "=_", "mos", "hse", "qs_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mos", "hse", "q", "\\u", "path_", "=_", "mos", "hse", "q_", "._", "\\u\\u", "str\\u\\u_", "(_", ")_", "._", "split_", "(_", "'", " ", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mos", "hse", "q", "\\u", "start_", "=_", "mos", "hse", "q_", "._", "\\u\\u", "str\\u\\u_", "(_", ")_", "._", "split_", "(_", "'", " ", "'_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mos", "hse", "q", "\\u", "end_", "=_", "mos", "hse", "q_", "._", "\\u\\u", "str\\u\\u_", "(_", ")_", "._", "split_", "(_", "'", " ", "'_", ")_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "hil", "ite_", "(_", "\"\\\\", "n", "Enter", " ", "the", " ", "first", " ", "frame", " ", "of", " ", "mos", "hte", "x", " ", "sequence", ":\"_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "n", "Eg", ".", " ", "5", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mos", "hf", "irs", "t_", "=_", "raw", "\\u", "input_", "(_", "hil", "ite_", "(_", "\"", "mos", "hte", "x", "\\u", "first", "\\u", "fr", " ", "({", "0", "})", " ", ">", " ", " ", "\"_", "._", "format_", "(_", "mos", "hse", "q", "\\u", "start_", ")_", ",_", "16_", ")_", ")_", "or_", "mos", "hse", "q", "\\u", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "OUTPUT_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "hil", "ite_", "(_", "\"\\\\", "n", "Enter", " ", "the", " ", "output", " ", "director", "y", " ", "path", ":\"_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "n", "Eg", ".", " ", "/", "my", "/", "great", "/", "output", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outdir_", "=_", "raw", "\\u", "input_", "(_", "hil", "ite_", "(_", "\"", "output", "\\u", "path", " ", ">", " ", " ", "\"_", ",_", "16_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bitrate_", "=_", "raw", "\\u", "input_", "(_", "hil", "ite_", "(_", "\"", "Bit", "rate", " ", "(", "800", "0", ")", " ", ">", " ", "\"_", ",_", "16_", ")_", ")_", "or_", "\"", "800", "0", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keyframe", "_", "=_", "raw", "\\u", "input_", "(_", "hil", "ite_", "(_", "\"", "Key", "frame", " ", "(", "999", ")", " ", ">", " ", "\"_", ",_", "16_", ")_", ")_", "or_", "\"", "999", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "threshold_", "=_", "raw", "\\u", "input_", "(_", "hil", "ite_", "(_", "\"", "Thresh", "old", " ", "(", "100000000", ")", " ", ">", " ", "\"_", ",_", "16_", ")_", ")_", "or_", "\"", "100000000", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "interval_", "=_", "raw", "\\u", "input_", "(_", "hil", "ite_", "(_", "\"", "Interv", "al", " ", "(", "9", ")", " ", ">", " ", "\"_", ",_", "16_", ")_", ")_", "or_", "\"", "9", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uber", "_", "=_", "raw", "\\u", "input_", "(_", "hil", "ite_", "(_", "\"", "Ub", "er", " ", "Mos", "hio", "n", "?", " ", "(", "N", ")", " ", ">", " ", "\"_", ",_", "12_", ")_", ")_", "or_", "\"", "N", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "uber", "_", "in_", "[_", "'", "Y", "'_", ",_", "'", "y", "'_", ",_", "'", "ye", "s", "'_", ",_", "'", "YE", "S", "'_", ",_", "'", "Ye", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uber", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uber", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "inse", "q", "'_", ":_", "inse", "q", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "start", "'_", ":_", "start_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "end", "'_", ":_", "end_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mos", "hse", "q", "'_", ":_", "mos", "hse", "q", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mos", "hst", "art", "'_", ":_", "mos", "hf", "irs", "t_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "outd", "ir", "'_", ":_", "outdir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bit", "rate", "'_", ":_", "bitrate_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "keyframe", "'_", ":_", "keyframe", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "threshol", "d", "'_", ":_", "threshold_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "interval", "'_", ":_", "interval_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "uber", "'_", ":_", "uber", "_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
heroku/salesforce-bulk/salesforce_bulk/salesforce_bulk.py
[ { "content": " def bulk_delete(self, job_id, object_type, where, batch_size=2500):\n query_job_id = self.create_query_job(object_type)\n soql = \"Select Id from %s where %s Limit 10000\" % (object_type, where)\n query_batch_id = self.query(query_job_id, soql)\n self.wait_for_batch(query_job_id, query_batch_id, timeout=120)\n\n results = []\n\n def save_results(tf, **kwargs):\n results.append(tf.read())\n\n flag = self.get_batch_results(\n query_job_id, query_batch_id, callback=save_results)\n\n if job_id is None:\n job_id = self.create_job(object_type, \"delete\")\n http = Http()\n # Split a large CSV into manageable batches\n batches = self.split_csv(csv, batch_size)\n batch_ids = []\n\n uri = self.endpoint + \"/job/%s/batch\" % job_id\n headers = self.headers({\"Content-Type\": \"text/csv\"})\n for batch in results:\n resp = requests.post(uri, data=batch, headers=headers)\n content = resp.content\n\n if resp.status_code >= 400:\n self.raise_error(content, resp.status)\n\n tree = ET.fromstring(content)\n batch_id = tree.findtext(\"{%s}id\" % self.jobNS)\n\n self.batches[batch_id] = job_id\n batch_ids.append(batch_id)\n\n return batch_ids", "metadata": "root.SalesforceBulk.bulk_delete", "header": "['class', 'SalesforceBulk', '(', 'object', ')', ':', '___EOS___']", "index": 304 } ]
[ { "span": "flag ", "start_line": 315, "start_column": 8, "end_line": 315, "end_column": 12 }, { "span": "http ", "start_line": 320, "start_column": 8, "end_line": 320, "end_column": 12 }, { "span": "batches ", "start_line": 322, "start_column": 8, "end_line": 322, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Sal", "es", "force", "Bul", "k_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bul", "k", "\\u", "delete_", "(_", "self_", ",_", "job", "\\u", "id_", ",_", "object\\u", "type_", ",_", "where_", ",_", "batch", "\\u", "size_", "=_", "2500_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query", "\\u", "job", "\\u", "id_", "=_", "self_", "._", "create", "\\u", "query", "\\u", "job_", "(_", "object\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "so", "ql_", "=_", "\"", "Select", " ", "Id", " ", "from", " ", "%", "s", " ", "where", " ", "%", "s", " ", "Limit", " ", "10000", "\"_", "%_", "(_", "object\\u", "type_", ",_", "where_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query", "\\u", "batch", "\\u", "id_", "=_", "self_", "._", "query_", "(_", "query", "\\u", "job", "\\u", "id_", ",_", "so", "ql_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wait", "\\u", "for", "\\u", "batch_", "(_", "query", "\\u", "job", "\\u", "id_", ",_", "query", "\\u", "batch", "\\u", "id_", ",_", "timeout_", "=_", "120_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "save", "\\u", "results_", "(_", "tf_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "._", "append_", "(_", "tf_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "flag_", "=_", "self_", "._", "get", "\\u", "batch", "\\u", "results_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "query", "\\u", "job", "\\u", "id_", ",_", "query", "\\u", "batch", "\\u", "id_", ",_", "callback_", "=_", "save", "\\u", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "job", "\\u", "id_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "job", "\\u", "id_", "=_", "self_", "._", "create", "\\u", "job_", "(_", "object\\u", "type_", ",_", "\"", "delete", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "http_", "=_", "Http_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Split", " ", "a", " ", "large", " ", "CSV", " ", "int", "o", " ", "manage", "able", " ", "batches_", "\\u\\u\\uNL\\u\\u\\u_", "batches_", "=_", "self_", "._", "split", "\\u", "csv_", "(_", "csv_", ",_", "batch", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "batch", "\\u", "ids_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "uri_", "=_", "self_", "._", "endpoint_", "+_", "\"/", "job", "/", "%", "s", "/", "batch", "\"_", "%_", "job", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "self_", "._", "headers_", "(_", "{_", "\"", "Conten", "t", "-", "Type", "\"_", ":_", "\"", "text", "/", "csv", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "batch_", "in_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "=_", "requests_", "._", "post_", "(_", "uri_", ",_", "data_", "=_", "batch_", ",_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "resp_", "._", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "resp_", "._", "status", "\\u", "code_", ">=_", "400_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "raise", "\\u", "error_", "(_", "content_", ",_", "resp_", "._", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tree_", "=_", "ET_", "._", "fromstring_", "(_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "batch", "\\u", "id_", "=_", "tree_", "._", "findtext_", "(_", "\"{", "%", "s", "}", "id", "\"_", "%_", "self_", "._", "job", "NS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "batches_", "[_", "batch", "\\u", "id_", "]_", "=_", "job", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "batch", "\\u", "ids_", "._", "append_", "(_", "batch", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "batch", "\\u", "ids_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unreachable code
kayhayen/Nuitka/nuitka/nodes/FunctionNodes.py
[ { "content": " def computeExpression(self, constraint_collection):\n assert False\n\n # Function body is quite irreplaceable.\n return self, None, None", "metadata": "root.ExpressionFunctionBodyBase.computeExpression", "header": "['class', 'ExpressionFunctionBodyBase', '(', 'ClosureTakerMixin', ',', 'ChildrenHavingMixin', ',', '___NL___', 'ClosureGiverNodeBase', ',', 'ExpressionMixin', ')', ':', '___EOS___']", "index": 282 }, { "content": " def computeExpressionCall(self, call_node, call_args, call_kw,\n constraint_collection):\n\n constraint_collection.onExceptionRaiseExit(BaseException)\n\n # TODO: Until we have something to re-order the keyword arguments, we\n # need to skip this. For the immediate need, we avoid this complexity,\n # as a re-ordering will be needed.\n if call_kw is not None and \\\n (not call_kw.isExpressionConstantRef() or call_kw.getConstant() != {}):\n return call_node, None, None\n\n if call_kw is not None:\n return call_node, None, None\n\n if call_args is None:\n args_tuple = ()\n elif call_args.isExpressionConstantRef() or \\\n call_args.isExpressionMakeTuple():\n args_tuple = call_args.getIterationValues()\n else:\n # TODO: Can this even happen, i.e. does the above check make\n # sense.\n assert False, call_args\n\n return call_node, None, None\n\n function_body = self.getFunctionRef().getFunctionBody()\n\n # TODO: Actually the above disables it entirely, as it is at least\n # the empty dictionary node in any case. We will need some enhanced\n # interfaces for \"matchCall\" to work on.\n\n call_spec = function_body.getParameters()\n\n try:\n args_dict = matchCall(\n func_name = self.getName(),\n args = call_spec.getArgumentNames(),\n star_list_arg = call_spec.getStarListArgumentName(),\n star_dict_arg = call_spec.getStarDictArgumentName(),\n num_defaults = call_spec.getDefaultCount(),\n positional = args_tuple,\n pairs = ()\n )\n\n values = [\n args_dict[name]\n for name in\n call_spec.getParameterNames()\n ]\n\n result = ExpressionFunctionCall(\n function = self,\n values = values,\n source_ref = call_node.getSourceReference()\n )\n\n return (\n result,\n \"new_statements\", # TODO: More appropriate tag maybe.\n \"\"\"\\\nReplaced call to created function body '%s' with direct \\\nfunction call.\"\"\" % self.getName()\n )\n\n except TooManyArguments as e:\n result = wrapExpressionWithSideEffects(\n new_node = makeRaiseExceptionReplacementExpressionFromInstance(\n expression = call_node,\n exception = e.getRealException()\n ),\n old_node = call_node,\n side_effects = call_node.extractPreCallSideEffects()\n )\n\n return (\n result,\n \"new_raise\", # TODO: More appropriate tag maybe.\n \"\"\"Replaced call to created function body '%s' to argument \\\nerror\"\"\" % self.getName()\n )", "metadata": "root.ExpressionFunctionCreation.computeExpressionCall", "header": "['class', 'ExpressionFunctionCreation', '(', 'SideEffectsFromChildrenMixin', ',', '___NL___', 'ExpressionChildrenHavingBase', ')', ':', '___EOS___']", "index": 559 }, { "content": " def getCallCost(self, values):\n # TODO: Ought to use values. If they are all constant, how about we\n # assume no cost, pylint: disable=W0613\n\n if not Options.isExperimental():\n return None\n\n function_body = self.getFunctionRef().getFunctionBody()\n\n if function_body.isExpressionGeneratorObjectBody():\n # TODO: That's not even allowed, is it?\n assert False\n\n return None\n\n if function_body.isExpressionClassBody():\n return None\n\n # TODO: Lying for the demo, this is too limiting, but needs frames to\n # be allowed twice in a context.\n if function_body.mayRaiseException(BaseException):\n return 60\n\n return 20", "metadata": "root.ExpressionFunctionCreation.getCallCost", "header": "['class', 'ExpressionFunctionCreation', '(', 'SideEffectsFromChildrenMixin', ',', '___NL___', 'ExpressionChildrenHavingBase', ')', ':', '___EOS___']", "index": 642 } ]
[ { "span": "return self, None, None", "start_line": 286, "start_column": 8, "end_line": 286, "end_column": 31 }, { "span": "return call_node, None, None", "start_line": 584, "start_column": 12, "end_line": 584, "end_column": 40 }, { "span": "return None", "start_line": 655, "start_column": 12, "end_line": 655, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Expression", "Function", "Bod", "y", "Base_", "(_", "Clos", "ure", "Tak", "er", "Mixin_", ",_", "Chil", "dre", "n", "Ha", "ving", "Mixin_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Clos", "ure", "Give", "r", "Node", "Base_", ",_", "Expression", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "Expression_", "(_", "self_", ",_", "constraint", "\\u", "collection_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Function", " ", "body", " ", "is", " ", "quite", " ", "irre", "place", "able", "._", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", ",_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Expression", "Function", "Creat", "ion_", "(_", "Side", "Effe", "ct", "s", "Fro", "m", "Chil", "dre", "n", "Mixin_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Expression", "Chil", "dre", "n", "Ha", "ving", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "Expression", "Call_", "(_", "self_", ",_", "call", "\\u", "node_", ",_", "call", "\\u", "args_", ",_", "call", "\\u", "kw_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "constraint", "\\u", "collection_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "constraint", "\\u", "collection_", "._", "on", "Except", "ion", "Rai", "se", "Exit_", "(_", "Base", "Exception_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Unti", "l", " ", "we", " ", "have", " ", "somet", "hing", " ", "to", " ", "re", "-", "order", " ", "the", " ", "keyw", "ord", " ", "argu", "ment", "s", ",", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "need", " ", "to", " ", "skip", " ", "this", ".", " ", "For", " ", "the", " ", "immediate", " ", "need", ",", " ", "we", " ", "avoid", " ", "this", " ", "complex", "it", "y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "a", " ", "re", "-", "orderi", "ng", " ", "will", " ", "be", " ", "need", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "call", "\\u", "kw_", "is_", "not_", "None_", "and_", "(_", "not_", "call", "\\u", "kw_", "._", "is", "Expression", "Const", "ant", "Ref_", "(_", ")_", "or_", "call", "\\u", "kw_", "._", "get", "Constant_", "(_", ")_", "!=_", "{_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "call", "\\u", "node_", ",_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "call", "\\u", "kw_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "call", "\\u", "node_", ",_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "call", "\\u", "args_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args", "\\u", "tuple_", "=_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "call", "\\u", "args_", "._", "is", "Expression", "Const", "ant", "Ref_", "(_", ")_", "or_", "call", "\\u", "args_", "._", "is", "Expression", "Make", "Tuple_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args", "\\u", "tuple_", "=_", "call", "\\u", "args_", "._", "get", "Iterat", "ion", "Values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Can", " ", "this", " ", "even", " ", "happ", "en", ",", " ", "i", ".", "e", ".", " ", "doe", "s", " ", "the", " ", "above", " ", "check", " ", "make_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sense", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "False_", ",_", "call", "\\u", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "call", "\\u", "node_", ",_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "function", "\\u", "body_", "=_", "self_", "._", "get", "Function", "Ref_", "(_", ")_", "._", "get", "Function", "Body_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Actual", "ly", " ", "the", " ", "above", " ", "disable", "s", " ", "it", " ", "entire", "ly", ",", " ", "as", " ", "it", " ", "is", " ", "at", " ", "leas", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "empty", " ", "dictionar", "y", " ", "node", " ", "in", " ", "any", " ", "case", ".", " ", "We", " ", "will", " ", "need", " ", "some", " ", "enhance", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "interface", "s", " ", "for", " ", "\"", "match", "Call", "\"", " ", "to", " ", "work", " ", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "call", "\\u", "spec_", "=_", "function", "\\u", "body_", "._", "get", "Parameters_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args", "\\u", "dict_", "=_", "match", "Call_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "func", "\\u", "name_", "=_", "self_", "._", "get", "Name_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "call", "\\u", "spec_", "._", "get", "Arg", "ument", "Names_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "star", "\\u", "list", "\\u", "arg_", "=_", "call", "\\u", "spec_", "._", "get", "Star", "List", "Arg", "ument", "Name_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "star", "\\u", "dict", "\\u", "arg_", "=_", "call", "\\u", "spec_", "._", "get", "Star", "Dict", "Arg", "ument", "Name_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "defaults_", "=_", "call", "\\u", "spec_", "._", "get", "Default", "Count_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "positional", "_", "=_", "args", "\\u", "tuple_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pairs_", "=_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "values_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "args", "\\u", "dict_", "[_", "name_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "name_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "call", "\\u", "spec_", "._", "get", "Parameter", "Names_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "Expression", "Function", "Call_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "function_", "=_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "values_", "=_", "values_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "ref_", "=_", "call", "\\u", "node_", "._", "get", "Sou", "rce", "Reference_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "result_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "new", "\\u", "statem", "ents", "\"_", ",_", "#", " ", "TOD", "O", ":", " ", "Mor", "e", " ", "appropr", "iate", " ", "tag", " ", "may", "be", "._", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\\\", "\\", "10", ";", "Replace", "d", " ", "call", " ", "to", " ", "created", " ", "function", " ", "body", " ", "'%", "s", "'", " ", "with", " ", "direct", " ", "\\\\", "\\", "10", ";", "function", " ", "call", ".\"\"\"_", "%_", "self_", "._", "get", "Name_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Too", "Many", "Arguments_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "wrap", "Expression", "With", "Side", "Effe", "cts_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "node_", "=_", "make", "Rai", "se", "Except", "ion", "Replace", "ment", "Expression", "Fro", "m", "Instance_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "expression_", "=_", "call", "\\u", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exception_", "=_", "e_", "._", "get", "Real", "Exception_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "old", "\\u", "node_", "=_", "call", "\\u", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "side", "\\u", "effects_", "=_", "call", "\\u", "node_", "._", "extract", "Pre", "Call", "Side", "Effe", "cts_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "result_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "new", "\\u", "raise", "\"_", ",_", "#", " ", "TOD", "O", ":", " ", "Mor", "e", " ", "appropr", "iate", " ", "tag", " ", "may", "be", "._", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Replace", "d", " ", "call", " ", "to", " ", "created", " ", "function", " ", "body", " ", "'%", "s", "'", " ", "to", " ", "argu", "ment", " ", "\\\\", "\\", "10", ";", "error", "\"\"\"_", "%_", "self_", "._", "get", "Name_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Expression", "Function", "Creat", "ion_", "(_", "Side", "Effe", "ct", "s", "Fro", "m", "Chil", "dre", "n", "Mixin_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Expression", "Chil", "dre", "n", "Ha", "ving", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Call", "Cost_", "(_", "self_", ",_", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Ou", "ght", " ", "to", " ", "use", " ", "values", ".", " ", "If", " ", "the", "y", " ", "are", " ", "all", " ", "constant", ",", " ", "how", " ", "abo", "ut", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assume", " ", "no", " ", "cost", ",", " ", "pylint", ":", " ", "disable", "=", "W", "061", "3_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "Options_", "._", "is", "Experiment", "al_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "function", "\\u", "body_", "=_", "self_", "._", "get", "Function", "Ref_", "(_", ")_", "._", "get", "Function", "Body_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "function", "\\u", "body_", "._", "is", "Expression", "Generat", "or", "Object", "Body_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Tha", "t", "'", "s", " ", "not", " ", "even", " ", "allow", "ed", ",", " ", "is", " ", "it", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "function", "\\u", "body_", "._", "is", "Expression", "Class", "Body_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Ly", "ing", " ", "for", " ", "the", " ", "demo", ",", " ", "this", " ", "is", " ", "too", " ", "limit", "ing", ",", " ", "but", " ", "need", "s", " ", "frames", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "allow", "ed", " ", "twi", "ce", " ", "in", " ", "a", " ", "context", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "function", "\\u", "body_", "._", "may", "Rai", "se", "Exception_", "(_", "Base", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "60_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "20_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
AppScale/appscale/AppServer/google/appengine/api/modules/modules_service_pb.py
[ { "content": "#!/usr/bin/env python\n#\n# Copyright 2007 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n\n\nfrom google.net.proto import ProtocolBuffer\nimport array\nimport dummy_thread as thread\n\n__pychecker__ = \"\"\"maxreturns=0 maxbranches=0 no-callinit\n unusednames=printElemNumber,debug_strs no-special\"\"\"\n\nif hasattr(ProtocolBuffer, 'ExtendableProtocolMessage'):\n _extension_runtime = True\n _ExtendableProtocolMessage = ProtocolBuffer.ExtendableProtocolMessage\nelse:\n _extension_runtime = False\n _ExtendableProtocolMessage = ProtocolBuffer.ProtocolMessage\n\nif _extension_runtime:\n pass\n\n__all__ = ['ModulesServiceError','GetModulesRequest','GetModulesResponse','GetVersionsRequest','GetVersionsResponse','GetDefaultVersionRequest','GetDefaultVersionResponse','GetNumInstancesRequest','GetNumInstancesResponse','SetNumInstancesRequest','SetNumInstancesResponse','StartModuleRequest','StartModuleResponse','StopModuleRequest','StopModuleResponse','GetHostnameRequest','GetHostnameResponse']\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ModulesServiceError(ProtocolBuffer.ProtocolMessage):\n\n\n OK = 0\n INVALID_MODULE = 1\n INVALID_VERSION = 2\n INVALID_INSTANCES = 3\n TRANSIENT_ERROR = 4\n UNEXPECTED_STATE = 5\n\n _ErrorCode_NAMES = {\n 0: \"OK\",\n 1: \"INVALID_MODULE\",\n 2: \"INVALID_VERSION\",\n 3: \"INVALID_INSTANCES\",\n 4: \"TRANSIENT_ERROR\",\n 5: \"UNEXPECTED_STATE\",\n }\n\n ErrorCode_Name = classmethod(ErrorCode_Name)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n _TEXT = _BuildTagLookupTable({\n 0: \"ErrorCode\",\n }, 0)\n\n _TYPES = _BuildTagLookupTable({\n 0: ProtocolBuffer.Encoder.NUMERIC,\n }, 0, ProtocolBuffer.Encoder.MAX_TYPE)\n\n\n _STYLE = \"\"\"\"\"\"\n _STYLE_CONTENT_TYPE = \"\"\"\"\"\"\n _PROTO_DESCRIPTOR_NAME = 'apphosting.ModulesServiceError'", "metadata": "root.ModulesServiceError", "header": "['module', '___EOS___']", "index": 33 }, { "content": " def ErrorCode_Name(cls, x): return cls._ErrorCode_NAMES.get(x, \"\")", "metadata": "root.ModulesServiceError.ErrorCode_Name", "header": "['class', 'ModulesServiceError', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 52 }, { "content": " def __init__(self, contents=None):\n pass\n if contents is not None: self.MergeFromString(contents)", "metadata": "root.ModulesServiceError.__init__", "header": "['class', 'ModulesServiceError', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 56 }, { "content": " def MergeFrom(self, x):\n assert x is not self", "metadata": "root.ModulesServiceError.MergeFrom", "header": "['class', 'ModulesServiceError', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 61 }, { "content": " def Equals(self, x):\n if x is self: return 1\n return 1", "metadata": "root.ModulesServiceError.Equals", "header": "['class', 'ModulesServiceError', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 64 }, { "content": " def IsInitialized(self, debug_strs=None):\n initialized = 1\n return initialized", "metadata": "root.ModulesServiceError.IsInitialized", "header": "['class', 'ModulesServiceError', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 68 }, { "content": " def ByteSize(self):\n n = 0\n return n", "metadata": "root.ModulesServiceError.ByteSize", "header": "['class', 'ModulesServiceError', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 72 }, { "content": " def ByteSizePartial(self):\n n = 0\n return n", "metadata": "root.ModulesServiceError.ByteSizePartial", "header": "['class', 'ModulesServiceError', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 76 }, { "content": " def Clear(self):\n pass", "metadata": "root.ModulesServiceError.Clear", "header": "['class', 'ModulesServiceError', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 80 }, { "content": " def OutputUnchecked(self, out):\n pass", "metadata": "root.ModulesServiceError.OutputUnchecked", "header": "['class', 'ModulesServiceError', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 83 }, { "content": " def OutputPartial(self, out):\n pass", "metadata": "root.ModulesServiceError.OutputPartial", "header": "['class', 'ModulesServiceError', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 86 }, { "content": " def TryMerge(self, d):\n while d.avail() > 0:\n tt = d.getVarInt32()\n\n\n if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError\n d.skipData(tt)", "metadata": "root.ModulesServiceError.TryMerge", "header": "['class', 'ModulesServiceError', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 89 }, { "content": " def __str__(self, prefix=\"\", printElemNumber=0):\n res=\"\"\n return res", "metadata": "root.ModulesServiceError.__str__", "header": "['class', 'ModulesServiceError', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 98 }, { "content": " def _BuildTagLookupTable(sparse, maxtag, default=None):\n return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])", "metadata": "root.ModulesServiceError._BuildTagLookupTable", "header": "['class', 'ModulesServiceError', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 103 }, { "content": "class GetModulesRequest(ProtocolBuffer.ProtocolMessage):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n _TEXT = _BuildTagLookupTable({\n 0: \"ErrorCode\",\n }, 0)\n\n _TYPES = _BuildTagLookupTable({\n 0: ProtocolBuffer.Encoder.NUMERIC,\n }, 0, ProtocolBuffer.Encoder.MAX_TYPE)\n\n\n _STYLE = \"\"\"\"\"\"\n _STYLE_CONTENT_TYPE = \"\"\"\"\"\"\n _PROTO_DESCRIPTOR_NAME = 'apphosting.GetModulesRequest'", "metadata": "root.GetModulesRequest", "header": "['module', '___EOS___']", "index": 119 }, { "content": " def __init__(self, contents=None):\n pass\n if contents is not None: self.MergeFromString(contents)", "metadata": "root.GetModulesRequest.__init__", "header": "['class', 'GetModulesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 121 }, { "content": " def MergeFrom(self, x):\n assert x is not self", "metadata": "root.GetModulesRequest.MergeFrom", "header": "['class', 'GetModulesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 126 }, { "content": " def Equals(self, x):\n if x is self: return 1\n return 1", "metadata": "root.GetModulesRequest.Equals", "header": "['class', 'GetModulesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 129 }, { "content": " def IsInitialized(self, debug_strs=None):\n initialized = 1\n return initialized", "metadata": "root.GetModulesRequest.IsInitialized", "header": "['class', 'GetModulesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 133 }, { "content": " def ByteSize(self):\n n = 0\n return n", "metadata": "root.GetModulesRequest.ByteSize", "header": "['class', 'GetModulesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 137 }, { "content": " def ByteSizePartial(self):\n n = 0\n return n", "metadata": "root.GetModulesRequest.ByteSizePartial", "header": "['class', 'GetModulesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 141 }, { "content": " def Clear(self):\n pass", "metadata": "root.GetModulesRequest.Clear", "header": "['class', 'GetModulesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 145 }, { "content": " def OutputUnchecked(self, out):\n pass", "metadata": "root.GetModulesRequest.OutputUnchecked", "header": "['class', 'GetModulesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 148 }, { "content": " def OutputPartial(self, out):\n pass", "metadata": "root.GetModulesRequest.OutputPartial", "header": "['class', 'GetModulesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 151 }, { "content": " def TryMerge(self, d):\n while d.avail() > 0:\n tt = d.getVarInt32()\n\n\n if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError\n d.skipData(tt)", "metadata": "root.GetModulesRequest.TryMerge", "header": "['class', 'GetModulesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 154 }, { "content": " def __str__(self, prefix=\"\", printElemNumber=0):\n res=\"\"\n return res", "metadata": "root.GetModulesRequest.__str__", "header": "['class', 'GetModulesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 163 }, { "content": " def _BuildTagLookupTable(sparse, maxtag, default=None):\n return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])", "metadata": "root.GetModulesRequest._BuildTagLookupTable", "header": "['class', 'GetModulesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 168 }, { "content": "class GetModulesResponse(ProtocolBuffer.ProtocolMessage):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n kmodule = 1\n\n _TEXT = _BuildTagLookupTable({\n 0: \"ErrorCode\",\n 1: \"module\",\n }, 1)\n\n _TYPES = _BuildTagLookupTable({\n 0: ProtocolBuffer.Encoder.NUMERIC,\n 1: ProtocolBuffer.Encoder.STRING,\n }, 1, ProtocolBuffer.Encoder.MAX_TYPE)\n\n\n _STYLE = \"\"\"\"\"\"\n _STYLE_CONTENT_TYPE = \"\"\"\"\"\"\n _PROTO_DESCRIPTOR_NAME = 'apphosting.GetModulesResponse'", "metadata": "root.GetModulesResponse", "header": "['module', '___EOS___']", "index": 184 }, { "content": " def __init__(self, contents=None):\n self.module_ = []\n if contents is not None: self.MergeFromString(contents)", "metadata": "root.GetModulesResponse.__init__", "header": "['class', 'GetModulesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 186 }, { "content": " def module_size(self): return len(self.module_)", "metadata": "root.GetModulesResponse.module_size", "header": "['class', 'GetModulesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 190 }, { "content": " def module_list(self): return self.module_", "metadata": "root.GetModulesResponse.module_list", "header": "['class', 'GetModulesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 191 }, { "content": " def module(self, i):\n return self.module_[i]", "metadata": "root.GetModulesResponse.module", "header": "['class', 'GetModulesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 193 }, { "content": " def set_module(self, i, x):\n self.module_[i] = x", "metadata": "root.GetModulesResponse.set_module", "header": "['class', 'GetModulesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 196 }, { "content": " def add_module(self, x):\n self.module_.append(x)", "metadata": "root.GetModulesResponse.add_module", "header": "['class', 'GetModulesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 199 }, { "content": " def clear_module(self):\n self.module_ = []", "metadata": "root.GetModulesResponse.clear_module", "header": "['class', 'GetModulesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 202 }, { "content": " def MergeFrom(self, x):\n assert x is not self\n for i in xrange(x.module_size()): self.add_module(x.module(i))", "metadata": "root.GetModulesResponse.MergeFrom", "header": "['class', 'GetModulesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 206 }, { "content": " def Equals(self, x):\n if x is self: return 1\n if len(self.module_) != len(x.module_): return 0\n for e1, e2 in zip(self.module_, x.module_):\n if e1 != e2: return 0\n return 1", "metadata": "root.GetModulesResponse.Equals", "header": "['class', 'GetModulesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 210 }, { "content": " def IsInitialized(self, debug_strs=None):\n initialized = 1\n return initialized", "metadata": "root.GetModulesResponse.IsInitialized", "header": "['class', 'GetModulesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 217 }, { "content": " def ByteSize(self):\n n = 0\n n += 1 * len(self.module_)\n for i in xrange(len(self.module_)): n += self.lengthString(len(self.module_[i]))\n return n", "metadata": "root.GetModulesResponse.ByteSize", "header": "['class', 'GetModulesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 221 }, { "content": " def ByteSizePartial(self):\n n = 0\n n += 1 * len(self.module_)\n for i in xrange(len(self.module_)): n += self.lengthString(len(self.module_[i]))\n return n", "metadata": "root.GetModulesResponse.ByteSizePartial", "header": "['class', 'GetModulesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 227 }, { "content": " def Clear(self):\n self.clear_module()", "metadata": "root.GetModulesResponse.Clear", "header": "['class', 'GetModulesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 233 }, { "content": " def OutputUnchecked(self, out):\n for i in xrange(len(self.module_)):\n out.putVarInt32(10)\n out.putPrefixedString(self.module_[i])", "metadata": "root.GetModulesResponse.OutputUnchecked", "header": "['class', 'GetModulesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 236 }, { "content": " def OutputPartial(self, out):\n for i in xrange(len(self.module_)):\n out.putVarInt32(10)\n out.putPrefixedString(self.module_[i])", "metadata": "root.GetModulesResponse.OutputPartial", "header": "['class', 'GetModulesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 241 }, { "content": " def TryMerge(self, d):\n while d.avail() > 0:\n tt = d.getVarInt32()\n if tt == 10:\n self.add_module(d.getPrefixedString())\n continue\n\n\n if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError\n d.skipData(tt)", "metadata": "root.GetModulesResponse.TryMerge", "header": "['class', 'GetModulesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 246 }, { "content": " def __str__(self, prefix=\"\", printElemNumber=0):\n res=\"\"\n cnt=0\n for e in self.module_:\n elm=\"\"\n if printElemNumber: elm=\"(%d)\" % cnt\n res+=prefix+(\"module%s: %s\\n\" % (elm, self.DebugFormatString(e)))\n cnt+=1\n return res", "metadata": "root.GetModulesResponse.__str__", "header": "['class', 'GetModulesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 258 }, { "content": " def _BuildTagLookupTable(sparse, maxtag, default=None):\n return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])", "metadata": "root.GetModulesResponse._BuildTagLookupTable", "header": "['class', 'GetModulesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 269 }, { "content": "class GetVersionsRequest(ProtocolBuffer.ProtocolMessage):\n has_module_ = 0\n module_ = \"\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n kmodule = 1\n\n _TEXT = _BuildTagLookupTable({\n 0: \"ErrorCode\",\n 1: \"module\",\n }, 1)\n\n _TYPES = _BuildTagLookupTable({\n 0: ProtocolBuffer.Encoder.NUMERIC,\n 1: ProtocolBuffer.Encoder.STRING,\n }, 1, ProtocolBuffer.Encoder.MAX_TYPE)\n\n\n _STYLE = \"\"\"\"\"\"\n _STYLE_CONTENT_TYPE = \"\"\"\"\"\"\n _PROTO_DESCRIPTOR_NAME = 'apphosting.GetVersionsRequest'", "metadata": "root.GetVersionsRequest", "header": "['module', '___EOS___']", "index": 288 }, { "content": " def __init__(self, contents=None):\n if contents is not None: self.MergeFromString(contents)", "metadata": "root.GetVersionsRequest.__init__", "header": "['class', 'GetVersionsRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 292 }, { "content": " def module(self): return self.module_", "metadata": "root.GetVersionsRequest.module", "header": "['class', 'GetVersionsRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 295 }, { "content": " def set_module(self, x):\n self.has_module_ = 1\n self.module_ = x", "metadata": "root.GetVersionsRequest.set_module", "header": "['class', 'GetVersionsRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 297 }, { "content": " def clear_module(self):\n if self.has_module_:\n self.has_module_ = 0\n self.module_ = \"\"", "metadata": "root.GetVersionsRequest.clear_module", "header": "['class', 'GetVersionsRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 301 }, { "content": " def has_module(self): return self.has_module_", "metadata": "root.GetVersionsRequest.has_module", "header": "['class', 'GetVersionsRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 306 }, { "content": " def MergeFrom(self, x):\n assert x is not self\n if (x.has_module()): self.set_module(x.module())", "metadata": "root.GetVersionsRequest.MergeFrom", "header": "['class', 'GetVersionsRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 309 }, { "content": " def Equals(self, x):\n if x is self: return 1\n if self.has_module_ != x.has_module_: return 0\n if self.has_module_ and self.module_ != x.module_: return 0\n return 1", "metadata": "root.GetVersionsRequest.Equals", "header": "['class', 'GetVersionsRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 313 }, { "content": " def IsInitialized(self, debug_strs=None):\n initialized = 1\n return initialized", "metadata": "root.GetVersionsRequest.IsInitialized", "header": "['class', 'GetVersionsRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 319 }, { "content": " def ByteSize(self):\n n = 0\n if (self.has_module_): n += 1 + self.lengthString(len(self.module_))\n return n", "metadata": "root.GetVersionsRequest.ByteSize", "header": "['class', 'GetVersionsRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 323 }, { "content": " def ByteSizePartial(self):\n n = 0\n if (self.has_module_): n += 1 + self.lengthString(len(self.module_))\n return n", "metadata": "root.GetVersionsRequest.ByteSizePartial", "header": "['class', 'GetVersionsRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 328 }, { "content": " def Clear(self):\n self.clear_module()", "metadata": "root.GetVersionsRequest.Clear", "header": "['class', 'GetVersionsRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 333 }, { "content": " def OutputUnchecked(self, out):\n if (self.has_module_):\n out.putVarInt32(10)\n out.putPrefixedString(self.module_)", "metadata": "root.GetVersionsRequest.OutputUnchecked", "header": "['class', 'GetVersionsRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 336 }, { "content": " def OutputPartial(self, out):\n if (self.has_module_):\n out.putVarInt32(10)\n out.putPrefixedString(self.module_)", "metadata": "root.GetVersionsRequest.OutputPartial", "header": "['class', 'GetVersionsRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 341 }, { "content": " def TryMerge(self, d):\n while d.avail() > 0:\n tt = d.getVarInt32()\n if tt == 10:\n self.set_module(d.getPrefixedString())\n continue\n\n\n if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError\n d.skipData(tt)", "metadata": "root.GetVersionsRequest.TryMerge", "header": "['class', 'GetVersionsRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 346 }, { "content": " def __str__(self, prefix=\"\", printElemNumber=0):\n res=\"\"\n if self.has_module_: res+=prefix+(\"module: %s\\n\" % self.DebugFormatString(self.module_))\n return res", "metadata": "root.GetVersionsRequest.__str__", "header": "['class', 'GetVersionsRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 358 }, { "content": " def _BuildTagLookupTable(sparse, maxtag, default=None):\n return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])", "metadata": "root.GetVersionsRequest._BuildTagLookupTable", "header": "['class', 'GetVersionsRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 364 }, { "content": "class GetVersionsResponse(ProtocolBuffer.ProtocolMessage):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n kversion = 1\n\n _TEXT = _BuildTagLookupTable({\n 0: \"ErrorCode\",\n 1: \"version\",\n }, 1)\n\n _TYPES = _BuildTagLookupTable({\n 0: ProtocolBuffer.Encoder.NUMERIC,\n 1: ProtocolBuffer.Encoder.STRING,\n }, 1, ProtocolBuffer.Encoder.MAX_TYPE)\n\n\n _STYLE = \"\"\"\"\"\"\n _STYLE_CONTENT_TYPE = \"\"\"\"\"\"\n _PROTO_DESCRIPTOR_NAME = 'apphosting.GetVersionsResponse'", "metadata": "root.GetVersionsResponse", "header": "['module', '___EOS___']", "index": 383 }, { "content": " def __init__(self, contents=None):\n self.version_ = []\n if contents is not None: self.MergeFromString(contents)", "metadata": "root.GetVersionsResponse.__init__", "header": "['class', 'GetVersionsResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 385 }, { "content": " def version_size(self): return len(self.version_)", "metadata": "root.GetVersionsResponse.version_size", "header": "['class', 'GetVersionsResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 389 }, { "content": " def version_list(self): return self.version_", "metadata": "root.GetVersionsResponse.version_list", "header": "['class', 'GetVersionsResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 390 }, { "content": " def version(self, i):\n return self.version_[i]", "metadata": "root.GetVersionsResponse.version", "header": "['class', 'GetVersionsResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 392 }, { "content": " def set_version(self, i, x):\n self.version_[i] = x", "metadata": "root.GetVersionsResponse.set_version", "header": "['class', 'GetVersionsResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 395 }, { "content": " def add_version(self, x):\n self.version_.append(x)", "metadata": "root.GetVersionsResponse.add_version", "header": "['class', 'GetVersionsResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 398 }, { "content": " def clear_version(self):\n self.version_ = []", "metadata": "root.GetVersionsResponse.clear_version", "header": "['class', 'GetVersionsResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 401 }, { "content": " def MergeFrom(self, x):\n assert x is not self\n for i in xrange(x.version_size()): self.add_version(x.version(i))", "metadata": "root.GetVersionsResponse.MergeFrom", "header": "['class', 'GetVersionsResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 405 }, { "content": " def Equals(self, x):\n if x is self: return 1\n if len(self.version_) != len(x.version_): return 0\n for e1, e2 in zip(self.version_, x.version_):\n if e1 != e2: return 0\n return 1", "metadata": "root.GetVersionsResponse.Equals", "header": "['class', 'GetVersionsResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 409 }, { "content": " def IsInitialized(self, debug_strs=None):\n initialized = 1\n return initialized", "metadata": "root.GetVersionsResponse.IsInitialized", "header": "['class', 'GetVersionsResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 416 }, { "content": " def ByteSize(self):\n n = 0\n n += 1 * len(self.version_)\n for i in xrange(len(self.version_)): n += self.lengthString(len(self.version_[i]))\n return n", "metadata": "root.GetVersionsResponse.ByteSize", "header": "['class', 'GetVersionsResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 420 }, { "content": " def ByteSizePartial(self):\n n = 0\n n += 1 * len(self.version_)\n for i in xrange(len(self.version_)): n += self.lengthString(len(self.version_[i]))\n return n", "metadata": "root.GetVersionsResponse.ByteSizePartial", "header": "['class', 'GetVersionsResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 426 }, { "content": " def Clear(self):\n self.clear_version()", "metadata": "root.GetVersionsResponse.Clear", "header": "['class', 'GetVersionsResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 432 }, { "content": " def OutputUnchecked(self, out):\n for i in xrange(len(self.version_)):\n out.putVarInt32(10)\n out.putPrefixedString(self.version_[i])", "metadata": "root.GetVersionsResponse.OutputUnchecked", "header": "['class', 'GetVersionsResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 435 }, { "content": " def OutputPartial(self, out):\n for i in xrange(len(self.version_)):\n out.putVarInt32(10)\n out.putPrefixedString(self.version_[i])", "metadata": "root.GetVersionsResponse.OutputPartial", "header": "['class', 'GetVersionsResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 440 }, { "content": " def TryMerge(self, d):\n while d.avail() > 0:\n tt = d.getVarInt32()\n if tt == 10:\n self.add_version(d.getPrefixedString())\n continue\n\n\n if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError\n d.skipData(tt)", "metadata": "root.GetVersionsResponse.TryMerge", "header": "['class', 'GetVersionsResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 445 }, { "content": " def __str__(self, prefix=\"\", printElemNumber=0):\n res=\"\"\n cnt=0\n for e in self.version_:\n elm=\"\"\n if printElemNumber: elm=\"(%d)\" % cnt\n res+=prefix+(\"version%s: %s\\n\" % (elm, self.DebugFormatString(e)))\n cnt+=1\n return res", "metadata": "root.GetVersionsResponse.__str__", "header": "['class', 'GetVersionsResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 457 }, { "content": " def _BuildTagLookupTable(sparse, maxtag, default=None):\n return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])", "metadata": "root.GetVersionsResponse._BuildTagLookupTable", "header": "['class', 'GetVersionsResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 468 }, { "content": "class GetDefaultVersionRequest(ProtocolBuffer.ProtocolMessage):\n has_module_ = 0\n module_ = \"\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n kmodule = 1\n\n _TEXT = _BuildTagLookupTable({\n 0: \"ErrorCode\",\n 1: \"module\",\n }, 1)\n\n _TYPES = _BuildTagLookupTable({\n 0: ProtocolBuffer.Encoder.NUMERIC,\n 1: ProtocolBuffer.Encoder.STRING,\n }, 1, ProtocolBuffer.Encoder.MAX_TYPE)\n\n\n _STYLE = \"\"\"\"\"\"\n _STYLE_CONTENT_TYPE = \"\"\"\"\"\"\n _PROTO_DESCRIPTOR_NAME = 'apphosting.GetDefaultVersionRequest'", "metadata": "root.GetDefaultVersionRequest", "header": "['module', '___EOS___']", "index": 487 }, { "content": " def __init__(self, contents=None):\n if contents is not None: self.MergeFromString(contents)", "metadata": "root.GetDefaultVersionRequest.__init__", "header": "['class', 'GetDefaultVersionRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 491 }, { "content": " def module(self): return self.module_", "metadata": "root.GetDefaultVersionRequest.module", "header": "['class', 'GetDefaultVersionRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 494 }, { "content": " def set_module(self, x):\n self.has_module_ = 1\n self.module_ = x", "metadata": "root.GetDefaultVersionRequest.set_module", "header": "['class', 'GetDefaultVersionRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 496 }, { "content": " def clear_module(self):\n if self.has_module_:\n self.has_module_ = 0\n self.module_ = \"\"", "metadata": "root.GetDefaultVersionRequest.clear_module", "header": "['class', 'GetDefaultVersionRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 500 }, { "content": " def has_module(self): return self.has_module_", "metadata": "root.GetDefaultVersionRequest.has_module", "header": "['class', 'GetDefaultVersionRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 505 }, { "content": " def MergeFrom(self, x):\n assert x is not self\n if (x.has_module()): self.set_module(x.module())", "metadata": "root.GetDefaultVersionRequest.MergeFrom", "header": "['class', 'GetDefaultVersionRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 508 }, { "content": " def Equals(self, x):\n if x is self: return 1\n if self.has_module_ != x.has_module_: return 0\n if self.has_module_ and self.module_ != x.module_: return 0\n return 1", "metadata": "root.GetDefaultVersionRequest.Equals", "header": "['class', 'GetDefaultVersionRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 512 }, { "content": " def IsInitialized(self, debug_strs=None):\n initialized = 1\n return initialized", "metadata": "root.GetDefaultVersionRequest.IsInitialized", "header": "['class', 'GetDefaultVersionRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 518 }, { "content": " def ByteSize(self):\n n = 0\n if (self.has_module_): n += 1 + self.lengthString(len(self.module_))\n return n", "metadata": "root.GetDefaultVersionRequest.ByteSize", "header": "['class', 'GetDefaultVersionRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 522 }, { "content": " def ByteSizePartial(self):\n n = 0\n if (self.has_module_): n += 1 + self.lengthString(len(self.module_))\n return n", "metadata": "root.GetDefaultVersionRequest.ByteSizePartial", "header": "['class', 'GetDefaultVersionRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 527 }, { "content": " def Clear(self):\n self.clear_module()", "metadata": "root.GetDefaultVersionRequest.Clear", "header": "['class', 'GetDefaultVersionRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 532 }, { "content": " def OutputUnchecked(self, out):\n if (self.has_module_):\n out.putVarInt32(10)\n out.putPrefixedString(self.module_)", "metadata": "root.GetDefaultVersionRequest.OutputUnchecked", "header": "['class', 'GetDefaultVersionRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 535 }, { "content": " def OutputPartial(self, out):\n if (self.has_module_):\n out.putVarInt32(10)\n out.putPrefixedString(self.module_)", "metadata": "root.GetDefaultVersionRequest.OutputPartial", "header": "['class', 'GetDefaultVersionRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 540 }, { "content": " def TryMerge(self, d):\n while d.avail() > 0:\n tt = d.getVarInt32()\n if tt == 10:\n self.set_module(d.getPrefixedString())\n continue\n\n\n if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError\n d.skipData(tt)", "metadata": "root.GetDefaultVersionRequest.TryMerge", "header": "['class', 'GetDefaultVersionRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 545 }, { "content": " def __str__(self, prefix=\"\", printElemNumber=0):\n res=\"\"\n if self.has_module_: res+=prefix+(\"module: %s\\n\" % self.DebugFormatString(self.module_))\n return res", "metadata": "root.GetDefaultVersionRequest.__str__", "header": "['class', 'GetDefaultVersionRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 557 }, { "content": " def _BuildTagLookupTable(sparse, maxtag, default=None):\n return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])", "metadata": "root.GetDefaultVersionRequest._BuildTagLookupTable", "header": "['class', 'GetDefaultVersionRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 563 }, { "content": "class GetDefaultVersionResponse(ProtocolBuffer.ProtocolMessage):\n has_version_ = 0\n version_ = \"\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n kversion = 1\n\n _TEXT = _BuildTagLookupTable({\n 0: \"ErrorCode\",\n 1: \"version\",\n }, 1)\n\n _TYPES = _BuildTagLookupTable({\n 0: ProtocolBuffer.Encoder.NUMERIC,\n 1: ProtocolBuffer.Encoder.STRING,\n }, 1, ProtocolBuffer.Encoder.MAX_TYPE)\n\n\n _STYLE = \"\"\"\"\"\"\n _STYLE_CONTENT_TYPE = \"\"\"\"\"\"\n _PROTO_DESCRIPTOR_NAME = 'apphosting.GetDefaultVersionResponse'", "metadata": "root.GetDefaultVersionResponse", "header": "['module', '___EOS___']", "index": 582 }, { "content": " def __init__(self, contents=None):\n if contents is not None: self.MergeFromString(contents)", "metadata": "root.GetDefaultVersionResponse.__init__", "header": "['class', 'GetDefaultVersionResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 586 }, { "content": " def version(self): return self.version_", "metadata": "root.GetDefaultVersionResponse.version", "header": "['class', 'GetDefaultVersionResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 589 }, { "content": " def set_version(self, x):\n self.has_version_ = 1\n self.version_ = x", "metadata": "root.GetDefaultVersionResponse.set_version", "header": "['class', 'GetDefaultVersionResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 591 }, { "content": " def clear_version(self):\n if self.has_version_:\n self.has_version_ = 0\n self.version_ = \"\"", "metadata": "root.GetDefaultVersionResponse.clear_version", "header": "['class', 'GetDefaultVersionResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 595 }, { "content": " def has_version(self): return self.has_version_", "metadata": "root.GetDefaultVersionResponse.has_version", "header": "['class', 'GetDefaultVersionResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 600 }, { "content": " def MergeFrom(self, x):\n assert x is not self\n if (x.has_version()): self.set_version(x.version())", "metadata": "root.GetDefaultVersionResponse.MergeFrom", "header": "['class', 'GetDefaultVersionResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 603 }, { "content": " def Equals(self, x):\n if x is self: return 1\n if self.has_version_ != x.has_version_: return 0\n if self.has_version_ and self.version_ != x.version_: return 0\n return 1", "metadata": "root.GetDefaultVersionResponse.Equals", "header": "['class', 'GetDefaultVersionResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 607 }, { "content": " def IsInitialized(self, debug_strs=None):\n initialized = 1\n if (not self.has_version_):\n initialized = 0\n if debug_strs is not None:\n debug_strs.append('Required field: version not set.')\n return initialized", "metadata": "root.GetDefaultVersionResponse.IsInitialized", "header": "['class', 'GetDefaultVersionResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 613 }, { "content": " def ByteSize(self):\n n = 0\n n += self.lengthString(len(self.version_))\n return n + 1", "metadata": "root.GetDefaultVersionResponse.ByteSize", "header": "['class', 'GetDefaultVersionResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 621 }, { "content": " def ByteSizePartial(self):\n n = 0\n if (self.has_version_):\n n += 1\n n += self.lengthString(len(self.version_))\n return n", "metadata": "root.GetDefaultVersionResponse.ByteSizePartial", "header": "['class', 'GetDefaultVersionResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 626 }, { "content": " def Clear(self):\n self.clear_version()", "metadata": "root.GetDefaultVersionResponse.Clear", "header": "['class', 'GetDefaultVersionResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 633 }, { "content": " def OutputUnchecked(self, out):\n out.putVarInt32(10)\n out.putPrefixedString(self.version_)", "metadata": "root.GetDefaultVersionResponse.OutputUnchecked", "header": "['class', 'GetDefaultVersionResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 636 }, { "content": " def OutputPartial(self, out):\n if (self.has_version_):\n out.putVarInt32(10)\n out.putPrefixedString(self.version_)", "metadata": "root.GetDefaultVersionResponse.OutputPartial", "header": "['class', 'GetDefaultVersionResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 640 }, { "content": " def TryMerge(self, d):\n while d.avail() > 0:\n tt = d.getVarInt32()\n if tt == 10:\n self.set_version(d.getPrefixedString())\n continue\n\n\n if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError\n d.skipData(tt)", "metadata": "root.GetDefaultVersionResponse.TryMerge", "header": "['class', 'GetDefaultVersionResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 645 }, { "content": " def __str__(self, prefix=\"\", printElemNumber=0):\n res=\"\"\n if self.has_version_: res+=prefix+(\"version: %s\\n\" % self.DebugFormatString(self.version_))\n return res", "metadata": "root.GetDefaultVersionResponse.__str__", "header": "['class', 'GetDefaultVersionResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 657 }, { "content": " def _BuildTagLookupTable(sparse, maxtag, default=None):\n return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])", "metadata": "root.GetDefaultVersionResponse._BuildTagLookupTable", "header": "['class', 'GetDefaultVersionResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 663 }, { "content": "class GetNumInstancesRequest(ProtocolBuffer.ProtocolMessage):\n has_module_ = 0\n module_ = \"\"\n has_version_ = 0\n version_ = \"\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n kmodule = 1\n kversion = 2\n\n _TEXT = _BuildTagLookupTable({\n 0: \"ErrorCode\",\n 1: \"module\",\n 2: \"version\",\n }, 2)\n\n _TYPES = _BuildTagLookupTable({\n 0: ProtocolBuffer.Encoder.NUMERIC,\n 1: ProtocolBuffer.Encoder.STRING,\n 2: ProtocolBuffer.Encoder.STRING,\n }, 2, ProtocolBuffer.Encoder.MAX_TYPE)\n\n\n _STYLE = \"\"\"\"\"\"\n _STYLE_CONTENT_TYPE = \"\"\"\"\"\"\n _PROTO_DESCRIPTOR_NAME = 'apphosting.GetNumInstancesRequest'", "metadata": "root.GetNumInstancesRequest", "header": "['module', '___EOS___']", "index": 682 }, { "content": " def __init__(self, contents=None):\n if contents is not None: self.MergeFromString(contents)", "metadata": "root.GetNumInstancesRequest.__init__", "header": "['class', 'GetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 688 }, { "content": " def module(self): return self.module_", "metadata": "root.GetNumInstancesRequest.module", "header": "['class', 'GetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 691 }, { "content": " def set_module(self, x):\n self.has_module_ = 1\n self.module_ = x", "metadata": "root.GetNumInstancesRequest.set_module", "header": "['class', 'GetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 693 }, { "content": " def clear_module(self):\n if self.has_module_:\n self.has_module_ = 0\n self.module_ = \"\"", "metadata": "root.GetNumInstancesRequest.clear_module", "header": "['class', 'GetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 697 }, { "content": " def has_module(self): return self.has_module_", "metadata": "root.GetNumInstancesRequest.has_module", "header": "['class', 'GetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 702 }, { "content": " def version(self): return self.version_", "metadata": "root.GetNumInstancesRequest.version", "header": "['class', 'GetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 704 }, { "content": " def set_version(self, x):\n self.has_version_ = 1\n self.version_ = x", "metadata": "root.GetNumInstancesRequest.set_version", "header": "['class', 'GetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 706 }, { "content": " def clear_version(self):\n if self.has_version_:\n self.has_version_ = 0\n self.version_ = \"\"", "metadata": "root.GetNumInstancesRequest.clear_version", "header": "['class', 'GetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 710 }, { "content": " def has_version(self): return self.has_version_", "metadata": "root.GetNumInstancesRequest.has_version", "header": "['class', 'GetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 715 }, { "content": " def MergeFrom(self, x):\n assert x is not self\n if (x.has_module()): self.set_module(x.module())\n if (x.has_version()): self.set_version(x.version())", "metadata": "root.GetNumInstancesRequest.MergeFrom", "header": "['class', 'GetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 718 }, { "content": " def Equals(self, x):\n if x is self: return 1\n if self.has_module_ != x.has_module_: return 0\n if self.has_module_ and self.module_ != x.module_: return 0\n if self.has_version_ != x.has_version_: return 0\n if self.has_version_ and self.version_ != x.version_: return 0\n return 1", "metadata": "root.GetNumInstancesRequest.Equals", "header": "['class', 'GetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 723 }, { "content": " def IsInitialized(self, debug_strs=None):\n initialized = 1\n return initialized", "metadata": "root.GetNumInstancesRequest.IsInitialized", "header": "['class', 'GetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 731 }, { "content": " def ByteSize(self):\n n = 0\n if (self.has_module_): n += 1 + self.lengthString(len(self.module_))\n if (self.has_version_): n += 1 + self.lengthString(len(self.version_))\n return n", "metadata": "root.GetNumInstancesRequest.ByteSize", "header": "['class', 'GetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 735 }, { "content": " def ByteSizePartial(self):\n n = 0\n if (self.has_module_): n += 1 + self.lengthString(len(self.module_))\n if (self.has_version_): n += 1 + self.lengthString(len(self.version_))\n return n", "metadata": "root.GetNumInstancesRequest.ByteSizePartial", "header": "['class', 'GetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 741 }, { "content": " def Clear(self):\n self.clear_module()\n self.clear_version()", "metadata": "root.GetNumInstancesRequest.Clear", "header": "['class', 'GetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 747 }, { "content": " def OutputUnchecked(self, out):\n if (self.has_module_):\n out.putVarInt32(10)\n out.putPrefixedString(self.module_)\n if (self.has_version_):\n out.putVarInt32(18)\n out.putPrefixedString(self.version_)", "metadata": "root.GetNumInstancesRequest.OutputUnchecked", "header": "['class', 'GetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 751 }, { "content": " def OutputPartial(self, out):\n if (self.has_module_):\n out.putVarInt32(10)\n out.putPrefixedString(self.module_)\n if (self.has_version_):\n out.putVarInt32(18)\n out.putPrefixedString(self.version_)", "metadata": "root.GetNumInstancesRequest.OutputPartial", "header": "['class', 'GetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 759 }, { "content": " def TryMerge(self, d):\n while d.avail() > 0:\n tt = d.getVarInt32()\n if tt == 10:\n self.set_module(d.getPrefixedString())\n continue\n if tt == 18:\n self.set_version(d.getPrefixedString())\n continue\n\n\n if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError\n d.skipData(tt)", "metadata": "root.GetNumInstancesRequest.TryMerge", "header": "['class', 'GetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 767 }, { "content": " def __str__(self, prefix=\"\", printElemNumber=0):\n res=\"\"\n if self.has_module_: res+=prefix+(\"module: %s\\n\" % self.DebugFormatString(self.module_))\n if self.has_version_: res+=prefix+(\"version: %s\\n\" % self.DebugFormatString(self.version_))\n return res", "metadata": "root.GetNumInstancesRequest.__str__", "header": "['class', 'GetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 782 }, { "content": " def _BuildTagLookupTable(sparse, maxtag, default=None):\n return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])", "metadata": "root.GetNumInstancesRequest._BuildTagLookupTable", "header": "['class', 'GetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 789 }, { "content": "class GetNumInstancesResponse(ProtocolBuffer.ProtocolMessage):\n has_instances_ = 0\n instances_ = 0\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n kinstances = 1\n\n _TEXT = _BuildTagLookupTable({\n 0: \"ErrorCode\",\n 1: \"instances\",\n }, 1)\n\n _TYPES = _BuildTagLookupTable({\n 0: ProtocolBuffer.Encoder.NUMERIC,\n 1: ProtocolBuffer.Encoder.NUMERIC,\n }, 1, ProtocolBuffer.Encoder.MAX_TYPE)\n\n\n _STYLE = \"\"\"\"\"\"\n _STYLE_CONTENT_TYPE = \"\"\"\"\"\"\n _PROTO_DESCRIPTOR_NAME = 'apphosting.GetNumInstancesResponse'", "metadata": "root.GetNumInstancesResponse", "header": "['module', '___EOS___']", "index": 811 }, { "content": " def __init__(self, contents=None):\n if contents is not None: self.MergeFromString(contents)", "metadata": "root.GetNumInstancesResponse.__init__", "header": "['class', 'GetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 815 }, { "content": " def instances(self): return self.instances_", "metadata": "root.GetNumInstancesResponse.instances", "header": "['class', 'GetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 818 }, { "content": " def set_instances(self, x):\n self.has_instances_ = 1\n self.instances_ = x", "metadata": "root.GetNumInstancesResponse.set_instances", "header": "['class', 'GetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 820 }, { "content": " def clear_instances(self):\n if self.has_instances_:\n self.has_instances_ = 0\n self.instances_ = 0", "metadata": "root.GetNumInstancesResponse.clear_instances", "header": "['class', 'GetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 824 }, { "content": " def has_instances(self): return self.has_instances_", "metadata": "root.GetNumInstancesResponse.has_instances", "header": "['class', 'GetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 829 }, { "content": " def MergeFrom(self, x):\n assert x is not self\n if (x.has_instances()): self.set_instances(x.instances())", "metadata": "root.GetNumInstancesResponse.MergeFrom", "header": "['class', 'GetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 832 }, { "content": " def Equals(self, x):\n if x is self: return 1\n if self.has_instances_ != x.has_instances_: return 0\n if self.has_instances_ and self.instances_ != x.instances_: return 0\n return 1", "metadata": "root.GetNumInstancesResponse.Equals", "header": "['class', 'GetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 836 }, { "content": " def IsInitialized(self, debug_strs=None):\n initialized = 1\n if (not self.has_instances_):\n initialized = 0\n if debug_strs is not None:\n debug_strs.append('Required field: instances not set.')\n return initialized", "metadata": "root.GetNumInstancesResponse.IsInitialized", "header": "['class', 'GetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 842 }, { "content": " def ByteSize(self):\n n = 0\n n += self.lengthVarInt64(self.instances_)\n return n + 1", "metadata": "root.GetNumInstancesResponse.ByteSize", "header": "['class', 'GetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 850 }, { "content": " def ByteSizePartial(self):\n n = 0\n if (self.has_instances_):\n n += 1\n n += self.lengthVarInt64(self.instances_)\n return n", "metadata": "root.GetNumInstancesResponse.ByteSizePartial", "header": "['class', 'GetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 855 }, { "content": " def Clear(self):\n self.clear_instances()", "metadata": "root.GetNumInstancesResponse.Clear", "header": "['class', 'GetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 862 }, { "content": " def OutputUnchecked(self, out):\n out.putVarInt32(8)\n out.putVarInt64(self.instances_)", "metadata": "root.GetNumInstancesResponse.OutputUnchecked", "header": "['class', 'GetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 865 }, { "content": " def OutputPartial(self, out):\n if (self.has_instances_):\n out.putVarInt32(8)\n out.putVarInt64(self.instances_)", "metadata": "root.GetNumInstancesResponse.OutputPartial", "header": "['class', 'GetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 869 }, { "content": " def TryMerge(self, d):\n while d.avail() > 0:\n tt = d.getVarInt32()\n if tt == 8:\n self.set_instances(d.getVarInt64())\n continue\n\n\n if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError\n d.skipData(tt)", "metadata": "root.GetNumInstancesResponse.TryMerge", "header": "['class', 'GetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 874 }, { "content": " def __str__(self, prefix=\"\", printElemNumber=0):\n res=\"\"\n if self.has_instances_: res+=prefix+(\"instances: %s\\n\" % self.DebugFormatInt64(self.instances_))\n return res", "metadata": "root.GetNumInstancesResponse.__str__", "header": "['class', 'GetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 886 }, { "content": " def _BuildTagLookupTable(sparse, maxtag, default=None):\n return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])", "metadata": "root.GetNumInstancesResponse._BuildTagLookupTable", "header": "['class', 'GetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 892 }, { "content": "class SetNumInstancesRequest(ProtocolBuffer.ProtocolMessage):\n has_module_ = 0\n module_ = \"\"\n has_version_ = 0\n version_ = \"\"\n has_instances_ = 0\n instances_ = 0\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n kmodule = 1\n kversion = 2\n kinstances = 3\n\n _TEXT = _BuildTagLookupTable({\n 0: \"ErrorCode\",\n 1: \"module\",\n 2: \"version\",\n 3: \"instances\",\n }, 3)\n\n _TYPES = _BuildTagLookupTable({\n 0: ProtocolBuffer.Encoder.NUMERIC,\n 1: ProtocolBuffer.Encoder.STRING,\n 2: ProtocolBuffer.Encoder.STRING,\n 3: ProtocolBuffer.Encoder.NUMERIC,\n }, 3, ProtocolBuffer.Encoder.MAX_TYPE)\n\n\n _STYLE = \"\"\"\"\"\"\n _STYLE_CONTENT_TYPE = \"\"\"\"\"\"\n _PROTO_DESCRIPTOR_NAME = 'apphosting.SetNumInstancesRequest'", "metadata": "root.SetNumInstancesRequest", "header": "['module', '___EOS___']", "index": 911 }, { "content": " def __init__(self, contents=None):\n if contents is not None: self.MergeFromString(contents)", "metadata": "root.SetNumInstancesRequest.__init__", "header": "['class', 'SetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 919 }, { "content": " def module(self): return self.module_", "metadata": "root.SetNumInstancesRequest.module", "header": "['class', 'SetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 922 }, { "content": " def set_module(self, x):\n self.has_module_ = 1\n self.module_ = x", "metadata": "root.SetNumInstancesRequest.set_module", "header": "['class', 'SetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 924 }, { "content": " def clear_module(self):\n if self.has_module_:\n self.has_module_ = 0\n self.module_ = \"\"", "metadata": "root.SetNumInstancesRequest.clear_module", "header": "['class', 'SetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 928 }, { "content": " def has_module(self): return self.has_module_", "metadata": "root.SetNumInstancesRequest.has_module", "header": "['class', 'SetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 933 }, { "content": " def version(self): return self.version_", "metadata": "root.SetNumInstancesRequest.version", "header": "['class', 'SetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 935 }, { "content": " def set_version(self, x):\n self.has_version_ = 1\n self.version_ = x", "metadata": "root.SetNumInstancesRequest.set_version", "header": "['class', 'SetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 937 }, { "content": " def clear_version(self):\n if self.has_version_:\n self.has_version_ = 0\n self.version_ = \"\"", "metadata": "root.SetNumInstancesRequest.clear_version", "header": "['class', 'SetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 941 }, { "content": " def has_version(self): return self.has_version_", "metadata": "root.SetNumInstancesRequest.has_version", "header": "['class', 'SetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 946 }, { "content": " def instances(self): return self.instances_", "metadata": "root.SetNumInstancesRequest.instances", "header": "['class', 'SetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 948 }, { "content": " def set_instances(self, x):\n self.has_instances_ = 1\n self.instances_ = x", "metadata": "root.SetNumInstancesRequest.set_instances", "header": "['class', 'SetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 950 }, { "content": " def clear_instances(self):\n if self.has_instances_:\n self.has_instances_ = 0\n self.instances_ = 0", "metadata": "root.SetNumInstancesRequest.clear_instances", "header": "['class', 'SetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 954 }, { "content": " def has_instances(self): return self.has_instances_", "metadata": "root.SetNumInstancesRequest.has_instances", "header": "['class', 'SetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 959 }, { "content": " def MergeFrom(self, x):\n assert x is not self\n if (x.has_module()): self.set_module(x.module())\n if (x.has_version()): self.set_version(x.version())\n if (x.has_instances()): self.set_instances(x.instances())", "metadata": "root.SetNumInstancesRequest.MergeFrom", "header": "['class', 'SetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 962 }, { "content": " def Equals(self, x):\n if x is self: return 1\n if self.has_module_ != x.has_module_: return 0\n if self.has_module_ and self.module_ != x.module_: return 0\n if self.has_version_ != x.has_version_: return 0\n if self.has_version_ and self.version_ != x.version_: return 0\n if self.has_instances_ != x.has_instances_: return 0\n if self.has_instances_ and self.instances_ != x.instances_: return 0\n return 1", "metadata": "root.SetNumInstancesRequest.Equals", "header": "['class', 'SetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 968 }, { "content": " def IsInitialized(self, debug_strs=None):\n initialized = 1\n if (not self.has_instances_):\n initialized = 0\n if debug_strs is not None:\n debug_strs.append('Required field: instances not set.')\n return initialized", "metadata": "root.SetNumInstancesRequest.IsInitialized", "header": "['class', 'SetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 978 }, { "content": " def ByteSize(self):\n n = 0\n if (self.has_module_): n += 1 + self.lengthString(len(self.module_))\n if (self.has_version_): n += 1 + self.lengthString(len(self.version_))\n n += self.lengthVarInt64(self.instances_)\n return n + 1", "metadata": "root.SetNumInstancesRequest.ByteSize", "header": "['class', 'SetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 986 }, { "content": " def ByteSizePartial(self):\n n = 0\n if (self.has_module_): n += 1 + self.lengthString(len(self.module_))\n if (self.has_version_): n += 1 + self.lengthString(len(self.version_))\n if (self.has_instances_):\n n += 1\n n += self.lengthVarInt64(self.instances_)\n return n", "metadata": "root.SetNumInstancesRequest.ByteSizePartial", "header": "['class', 'SetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 993 }, { "content": " def Clear(self):\n self.clear_module()\n self.clear_version()\n self.clear_instances()", "metadata": "root.SetNumInstancesRequest.Clear", "header": "['class', 'SetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1002 }, { "content": " def OutputUnchecked(self, out):\n if (self.has_module_):\n out.putVarInt32(10)\n out.putPrefixedString(self.module_)\n if (self.has_version_):\n out.putVarInt32(18)\n out.putPrefixedString(self.version_)\n out.putVarInt32(24)\n out.putVarInt64(self.instances_)", "metadata": "root.SetNumInstancesRequest.OutputUnchecked", "header": "['class', 'SetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1007 }, { "content": " def OutputPartial(self, out):\n if (self.has_module_):\n out.putVarInt32(10)\n out.putPrefixedString(self.module_)\n if (self.has_version_):\n out.putVarInt32(18)\n out.putPrefixedString(self.version_)\n if (self.has_instances_):\n out.putVarInt32(24)\n out.putVarInt64(self.instances_)", "metadata": "root.SetNumInstancesRequest.OutputPartial", "header": "['class', 'SetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1017 }, { "content": " def TryMerge(self, d):\n while d.avail() > 0:\n tt = d.getVarInt32()\n if tt == 10:\n self.set_module(d.getPrefixedString())\n continue\n if tt == 18:\n self.set_version(d.getPrefixedString())\n continue\n if tt == 24:\n self.set_instances(d.getVarInt64())\n continue\n\n\n if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError\n d.skipData(tt)", "metadata": "root.SetNumInstancesRequest.TryMerge", "header": "['class', 'SetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1028 }, { "content": " def __str__(self, prefix=\"\", printElemNumber=0):\n res=\"\"\n if self.has_module_: res+=prefix+(\"module: %s\\n\" % self.DebugFormatString(self.module_))\n if self.has_version_: res+=prefix+(\"version: %s\\n\" % self.DebugFormatString(self.version_))\n if self.has_instances_: res+=prefix+(\"instances: %s\\n\" % self.DebugFormatInt64(self.instances_))\n return res", "metadata": "root.SetNumInstancesRequest.__str__", "header": "['class', 'SetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1046 }, { "content": " def _BuildTagLookupTable(sparse, maxtag, default=None):\n return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])", "metadata": "root.SetNumInstancesRequest._BuildTagLookupTable", "header": "['class', 'SetNumInstancesRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1054 }, { "content": "class SetNumInstancesResponse(ProtocolBuffer.ProtocolMessage):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n _TEXT = _BuildTagLookupTable({\n 0: \"ErrorCode\",\n }, 0)\n\n _TYPES = _BuildTagLookupTable({\n 0: ProtocolBuffer.Encoder.NUMERIC,\n }, 0, ProtocolBuffer.Encoder.MAX_TYPE)\n\n\n _STYLE = \"\"\"\"\"\"\n _STYLE_CONTENT_TYPE = \"\"\"\"\"\"\n _PROTO_DESCRIPTOR_NAME = 'apphosting.SetNumInstancesResponse'", "metadata": "root.SetNumInstancesResponse", "header": "['module', '___EOS___']", "index": 1079 }, { "content": " def __init__(self, contents=None):\n pass\n if contents is not None: self.MergeFromString(contents)", "metadata": "root.SetNumInstancesResponse.__init__", "header": "['class', 'SetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1081 }, { "content": " def MergeFrom(self, x):\n assert x is not self", "metadata": "root.SetNumInstancesResponse.MergeFrom", "header": "['class', 'SetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1086 }, { "content": " def Equals(self, x):\n if x is self: return 1\n return 1", "metadata": "root.SetNumInstancesResponse.Equals", "header": "['class', 'SetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1089 }, { "content": " def IsInitialized(self, debug_strs=None):\n initialized = 1\n return initialized", "metadata": "root.SetNumInstancesResponse.IsInitialized", "header": "['class', 'SetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1093 }, { "content": " def ByteSize(self):\n n = 0\n return n", "metadata": "root.SetNumInstancesResponse.ByteSize", "header": "['class', 'SetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1097 }, { "content": " def ByteSizePartial(self):\n n = 0\n return n", "metadata": "root.SetNumInstancesResponse.ByteSizePartial", "header": "['class', 'SetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1101 }, { "content": " def Clear(self):\n pass", "metadata": "root.SetNumInstancesResponse.Clear", "header": "['class', 'SetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1105 }, { "content": " def OutputUnchecked(self, out):\n pass", "metadata": "root.SetNumInstancesResponse.OutputUnchecked", "header": "['class', 'SetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1108 }, { "content": " def OutputPartial(self, out):\n pass", "metadata": "root.SetNumInstancesResponse.OutputPartial", "header": "['class', 'SetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1111 }, { "content": " def TryMerge(self, d):\n while d.avail() > 0:\n tt = d.getVarInt32()\n\n\n if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError\n d.skipData(tt)", "metadata": "root.SetNumInstancesResponse.TryMerge", "header": "['class', 'SetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1114 }, { "content": " def __str__(self, prefix=\"\", printElemNumber=0):\n res=\"\"\n return res", "metadata": "root.SetNumInstancesResponse.__str__", "header": "['class', 'SetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1123 }, { "content": " def _BuildTagLookupTable(sparse, maxtag, default=None):\n return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])", "metadata": "root.SetNumInstancesResponse._BuildTagLookupTable", "header": "['class', 'SetNumInstancesResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1128 }, { "content": "class StartModuleRequest(ProtocolBuffer.ProtocolMessage):\n has_module_ = 0\n module_ = \"\"\n has_version_ = 0\n version_ = \"\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n kmodule = 1\n kversion = 2\n\n _TEXT = _BuildTagLookupTable({\n 0: \"ErrorCode\",\n 1: \"module\",\n 2: \"version\",\n }, 2)\n\n _TYPES = _BuildTagLookupTable({\n 0: ProtocolBuffer.Encoder.NUMERIC,\n 1: ProtocolBuffer.Encoder.STRING,\n 2: ProtocolBuffer.Encoder.STRING,\n }, 2, ProtocolBuffer.Encoder.MAX_TYPE)\n\n\n _STYLE = \"\"\"\"\"\"\n _STYLE_CONTENT_TYPE = \"\"\"\"\"\"\n _PROTO_DESCRIPTOR_NAME = 'apphosting.StartModuleRequest'", "metadata": "root.StartModuleRequest", "header": "['module', '___EOS___']", "index": 1144 }, { "content": " def __init__(self, contents=None):\n if contents is not None: self.MergeFromString(contents)", "metadata": "root.StartModuleRequest.__init__", "header": "['class', 'StartModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1150 }, { "content": " def module(self): return self.module_", "metadata": "root.StartModuleRequest.module", "header": "['class', 'StartModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1153 }, { "content": " def set_module(self, x):\n self.has_module_ = 1\n self.module_ = x", "metadata": "root.StartModuleRequest.set_module", "header": "['class', 'StartModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1155 }, { "content": " def clear_module(self):\n if self.has_module_:\n self.has_module_ = 0\n self.module_ = \"\"", "metadata": "root.StartModuleRequest.clear_module", "header": "['class', 'StartModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1159 }, { "content": " def has_module(self): return self.has_module_", "metadata": "root.StartModuleRequest.has_module", "header": "['class', 'StartModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1164 }, { "content": " def version(self): return self.version_", "metadata": "root.StartModuleRequest.version", "header": "['class', 'StartModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1166 }, { "content": " def set_version(self, x):\n self.has_version_ = 1\n self.version_ = x", "metadata": "root.StartModuleRequest.set_version", "header": "['class', 'StartModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1168 }, { "content": " def clear_version(self):\n if self.has_version_:\n self.has_version_ = 0\n self.version_ = \"\"", "metadata": "root.StartModuleRequest.clear_version", "header": "['class', 'StartModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1172 }, { "content": " def has_version(self): return self.has_version_", "metadata": "root.StartModuleRequest.has_version", "header": "['class', 'StartModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1177 }, { "content": " def MergeFrom(self, x):\n assert x is not self\n if (x.has_module()): self.set_module(x.module())\n if (x.has_version()): self.set_version(x.version())", "metadata": "root.StartModuleRequest.MergeFrom", "header": "['class', 'StartModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1180 }, { "content": " def Equals(self, x):\n if x is self: return 1\n if self.has_module_ != x.has_module_: return 0\n if self.has_module_ and self.module_ != x.module_: return 0\n if self.has_version_ != x.has_version_: return 0\n if self.has_version_ and self.version_ != x.version_: return 0\n return 1", "metadata": "root.StartModuleRequest.Equals", "header": "['class', 'StartModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1185 }, { "content": " def IsInitialized(self, debug_strs=None):\n initialized = 1\n if (not self.has_module_):\n initialized = 0\n if debug_strs is not None:\n debug_strs.append('Required field: module not set.')\n if (not self.has_version_):\n initialized = 0\n if debug_strs is not None:\n debug_strs.append('Required field: version not set.')\n return initialized", "metadata": "root.StartModuleRequest.IsInitialized", "header": "['class', 'StartModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1193 }, { "content": " def ByteSize(self):\n n = 0\n n += self.lengthString(len(self.module_))\n n += self.lengthString(len(self.version_))\n return n + 2", "metadata": "root.StartModuleRequest.ByteSize", "header": "['class', 'StartModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1205 }, { "content": " def ByteSizePartial(self):\n n = 0\n if (self.has_module_):\n n += 1\n n += self.lengthString(len(self.module_))\n if (self.has_version_):\n n += 1\n n += self.lengthString(len(self.version_))\n return n", "metadata": "root.StartModuleRequest.ByteSizePartial", "header": "['class', 'StartModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1211 }, { "content": " def Clear(self):\n self.clear_module()\n self.clear_version()", "metadata": "root.StartModuleRequest.Clear", "header": "['class', 'StartModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1221 }, { "content": " def OutputUnchecked(self, out):\n out.putVarInt32(10)\n out.putPrefixedString(self.module_)\n out.putVarInt32(18)\n out.putPrefixedString(self.version_)", "metadata": "root.StartModuleRequest.OutputUnchecked", "header": "['class', 'StartModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1225 }, { "content": " def OutputPartial(self, out):\n if (self.has_module_):\n out.putVarInt32(10)\n out.putPrefixedString(self.module_)\n if (self.has_version_):\n out.putVarInt32(18)\n out.putPrefixedString(self.version_)", "metadata": "root.StartModuleRequest.OutputPartial", "header": "['class', 'StartModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1231 }, { "content": " def TryMerge(self, d):\n while d.avail() > 0:\n tt = d.getVarInt32()\n if tt == 10:\n self.set_module(d.getPrefixedString())\n continue\n if tt == 18:\n self.set_version(d.getPrefixedString())\n continue\n\n\n if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError\n d.skipData(tt)", "metadata": "root.StartModuleRequest.TryMerge", "header": "['class', 'StartModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1239 }, { "content": " def __str__(self, prefix=\"\", printElemNumber=0):\n res=\"\"\n if self.has_module_: res+=prefix+(\"module: %s\\n\" % self.DebugFormatString(self.module_))\n if self.has_version_: res+=prefix+(\"version: %s\\n\" % self.DebugFormatString(self.version_))\n return res", "metadata": "root.StartModuleRequest.__str__", "header": "['class', 'StartModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1254 }, { "content": " def _BuildTagLookupTable(sparse, maxtag, default=None):\n return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])", "metadata": "root.StartModuleRequest._BuildTagLookupTable", "header": "['class', 'StartModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1261 }, { "content": "class StartModuleResponse(ProtocolBuffer.ProtocolMessage):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n _TEXT = _BuildTagLookupTable({\n 0: \"ErrorCode\",\n }, 0)\n\n _TYPES = _BuildTagLookupTable({\n 0: ProtocolBuffer.Encoder.NUMERIC,\n }, 0, ProtocolBuffer.Encoder.MAX_TYPE)\n\n\n _STYLE = \"\"\"\"\"\"\n _STYLE_CONTENT_TYPE = \"\"\"\"\"\"\n _PROTO_DESCRIPTOR_NAME = 'apphosting.StartModuleResponse'", "metadata": "root.StartModuleResponse", "header": "['module', '___EOS___']", "index": 1283 }, { "content": " def __init__(self, contents=None):\n pass\n if contents is not None: self.MergeFromString(contents)", "metadata": "root.StartModuleResponse.__init__", "header": "['class', 'StartModuleResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1285 }, { "content": " def MergeFrom(self, x):\n assert x is not self", "metadata": "root.StartModuleResponse.MergeFrom", "header": "['class', 'StartModuleResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1290 }, { "content": " def Equals(self, x):\n if x is self: return 1\n return 1", "metadata": "root.StartModuleResponse.Equals", "header": "['class', 'StartModuleResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1293 }, { "content": " def IsInitialized(self, debug_strs=None):\n initialized = 1\n return initialized", "metadata": "root.StartModuleResponse.IsInitialized", "header": "['class', 'StartModuleResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1297 }, { "content": " def ByteSize(self):\n n = 0\n return n", "metadata": "root.StartModuleResponse.ByteSize", "header": "['class', 'StartModuleResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1301 }, { "content": " def ByteSizePartial(self):\n n = 0\n return n", "metadata": "root.StartModuleResponse.ByteSizePartial", "header": "['class', 'StartModuleResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1305 }, { "content": " def Clear(self):\n pass", "metadata": "root.StartModuleResponse.Clear", "header": "['class', 'StartModuleResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1309 }, { "content": " def OutputUnchecked(self, out):\n pass", "metadata": "root.StartModuleResponse.OutputUnchecked", "header": "['class', 'StartModuleResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1312 }, { "content": " def OutputPartial(self, out):\n pass", "metadata": "root.StartModuleResponse.OutputPartial", "header": "['class', 'StartModuleResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1315 }, { "content": " def TryMerge(self, d):\n while d.avail() > 0:\n tt = d.getVarInt32()\n\n\n if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError\n d.skipData(tt)", "metadata": "root.StartModuleResponse.TryMerge", "header": "['class', 'StartModuleResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1318 }, { "content": " def __str__(self, prefix=\"\", printElemNumber=0):\n res=\"\"\n return res", "metadata": "root.StartModuleResponse.__str__", "header": "['class', 'StartModuleResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1327 }, { "content": " def _BuildTagLookupTable(sparse, maxtag, default=None):\n return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])", "metadata": "root.StartModuleResponse._BuildTagLookupTable", "header": "['class', 'StartModuleResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1332 }, { "content": "class StopModuleRequest(ProtocolBuffer.ProtocolMessage):\n has_module_ = 0\n module_ = \"\"\n has_version_ = 0\n version_ = \"\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n kmodule = 1\n kversion = 2\n\n _TEXT = _BuildTagLookupTable({\n 0: \"ErrorCode\",\n 1: \"module\",\n 2: \"version\",\n }, 2)\n\n _TYPES = _BuildTagLookupTable({\n 0: ProtocolBuffer.Encoder.NUMERIC,\n 1: ProtocolBuffer.Encoder.STRING,\n 2: ProtocolBuffer.Encoder.STRING,\n }, 2, ProtocolBuffer.Encoder.MAX_TYPE)\n\n\n _STYLE = \"\"\"\"\"\"\n _STYLE_CONTENT_TYPE = \"\"\"\"\"\"\n _PROTO_DESCRIPTOR_NAME = 'apphosting.StopModuleRequest'", "metadata": "root.StopModuleRequest", "header": "['module', '___EOS___']", "index": 1348 }, { "content": " def __init__(self, contents=None):\n if contents is not None: self.MergeFromString(contents)", "metadata": "root.StopModuleRequest.__init__", "header": "['class', 'StopModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1354 }, { "content": " def module(self): return self.module_", "metadata": "root.StopModuleRequest.module", "header": "['class', 'StopModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1357 }, { "content": " def set_module(self, x):\n self.has_module_ = 1\n self.module_ = x", "metadata": "root.StopModuleRequest.set_module", "header": "['class', 'StopModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1359 }, { "content": " def clear_module(self):\n if self.has_module_:\n self.has_module_ = 0\n self.module_ = \"\"", "metadata": "root.StopModuleRequest.clear_module", "header": "['class', 'StopModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1363 }, { "content": " def has_module(self): return self.has_module_", "metadata": "root.StopModuleRequest.has_module", "header": "['class', 'StopModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1368 }, { "content": " def version(self): return self.version_", "metadata": "root.StopModuleRequest.version", "header": "['class', 'StopModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1370 }, { "content": " def set_version(self, x):\n self.has_version_ = 1\n self.version_ = x", "metadata": "root.StopModuleRequest.set_version", "header": "['class', 'StopModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1372 }, { "content": " def clear_version(self):\n if self.has_version_:\n self.has_version_ = 0\n self.version_ = \"\"", "metadata": "root.StopModuleRequest.clear_version", "header": "['class', 'StopModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1376 }, { "content": " def has_version(self): return self.has_version_", "metadata": "root.StopModuleRequest.has_version", "header": "['class', 'StopModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1381 }, { "content": " def MergeFrom(self, x):\n assert x is not self\n if (x.has_module()): self.set_module(x.module())\n if (x.has_version()): self.set_version(x.version())", "metadata": "root.StopModuleRequest.MergeFrom", "header": "['class', 'StopModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1384 }, { "content": " def Equals(self, x):\n if x is self: return 1\n if self.has_module_ != x.has_module_: return 0\n if self.has_module_ and self.module_ != x.module_: return 0\n if self.has_version_ != x.has_version_: return 0\n if self.has_version_ and self.version_ != x.version_: return 0\n return 1", "metadata": "root.StopModuleRequest.Equals", "header": "['class', 'StopModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1389 }, { "content": " def IsInitialized(self, debug_strs=None):\n initialized = 1\n return initialized", "metadata": "root.StopModuleRequest.IsInitialized", "header": "['class', 'StopModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1397 }, { "content": " def ByteSize(self):\n n = 0\n if (self.has_module_): n += 1 + self.lengthString(len(self.module_))\n if (self.has_version_): n += 1 + self.lengthString(len(self.version_))\n return n", "metadata": "root.StopModuleRequest.ByteSize", "header": "['class', 'StopModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1401 }, { "content": " def ByteSizePartial(self):\n n = 0\n if (self.has_module_): n += 1 + self.lengthString(len(self.module_))\n if (self.has_version_): n += 1 + self.lengthString(len(self.version_))\n return n", "metadata": "root.StopModuleRequest.ByteSizePartial", "header": "['class', 'StopModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1407 }, { "content": " def Clear(self):\n self.clear_module()\n self.clear_version()", "metadata": "root.StopModuleRequest.Clear", "header": "['class', 'StopModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1413 }, { "content": " def OutputUnchecked(self, out):\n if (self.has_module_):\n out.putVarInt32(10)\n out.putPrefixedString(self.module_)\n if (self.has_version_):\n out.putVarInt32(18)\n out.putPrefixedString(self.version_)", "metadata": "root.StopModuleRequest.OutputUnchecked", "header": "['class', 'StopModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1417 }, { "content": " def OutputPartial(self, out):\n if (self.has_module_):\n out.putVarInt32(10)\n out.putPrefixedString(self.module_)\n if (self.has_version_):\n out.putVarInt32(18)\n out.putPrefixedString(self.version_)", "metadata": "root.StopModuleRequest.OutputPartial", "header": "['class', 'StopModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1425 }, { "content": " def TryMerge(self, d):\n while d.avail() > 0:\n tt = d.getVarInt32()\n if tt == 10:\n self.set_module(d.getPrefixedString())\n continue\n if tt == 18:\n self.set_version(d.getPrefixedString())\n continue\n\n\n if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError\n d.skipData(tt)", "metadata": "root.StopModuleRequest.TryMerge", "header": "['class', 'StopModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1433 }, { "content": " def __str__(self, prefix=\"\", printElemNumber=0):\n res=\"\"\n if self.has_module_: res+=prefix+(\"module: %s\\n\" % self.DebugFormatString(self.module_))\n if self.has_version_: res+=prefix+(\"version: %s\\n\" % self.DebugFormatString(self.version_))\n return res", "metadata": "root.StopModuleRequest.__str__", "header": "['class', 'StopModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1448 }, { "content": " def _BuildTagLookupTable(sparse, maxtag, default=None):\n return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])", "metadata": "root.StopModuleRequest._BuildTagLookupTable", "header": "['class', 'StopModuleRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1455 }, { "content": "class StopModuleResponse(ProtocolBuffer.ProtocolMessage):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n _TEXT = _BuildTagLookupTable({\n 0: \"ErrorCode\",\n }, 0)\n\n _TYPES = _BuildTagLookupTable({\n 0: ProtocolBuffer.Encoder.NUMERIC,\n }, 0, ProtocolBuffer.Encoder.MAX_TYPE)\n\n\n _STYLE = \"\"\"\"\"\"\n _STYLE_CONTENT_TYPE = \"\"\"\"\"\"\n _PROTO_DESCRIPTOR_NAME = 'apphosting.StopModuleResponse'", "metadata": "root.StopModuleResponse", "header": "['module', '___EOS___']", "index": 1477 }, { "content": " def __init__(self, contents=None):\n pass\n if contents is not None: self.MergeFromString(contents)", "metadata": "root.StopModuleResponse.__init__", "header": "['class', 'StopModuleResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1479 }, { "content": " def MergeFrom(self, x):\n assert x is not self", "metadata": "root.StopModuleResponse.MergeFrom", "header": "['class', 'StopModuleResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1484 }, { "content": " def Equals(self, x):\n if x is self: return 1\n return 1", "metadata": "root.StopModuleResponse.Equals", "header": "['class', 'StopModuleResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1487 }, { "content": " def IsInitialized(self, debug_strs=None):\n initialized = 1\n return initialized", "metadata": "root.StopModuleResponse.IsInitialized", "header": "['class', 'StopModuleResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1491 }, { "content": " def ByteSize(self):\n n = 0\n return n", "metadata": "root.StopModuleResponse.ByteSize", "header": "['class', 'StopModuleResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1495 }, { "content": " def ByteSizePartial(self):\n n = 0\n return n", "metadata": "root.StopModuleResponse.ByteSizePartial", "header": "['class', 'StopModuleResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1499 }, { "content": " def Clear(self):\n pass", "metadata": "root.StopModuleResponse.Clear", "header": "['class', 'StopModuleResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1503 }, { "content": " def OutputUnchecked(self, out):\n pass", "metadata": "root.StopModuleResponse.OutputUnchecked", "header": "['class', 'StopModuleResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1506 }, { "content": " def OutputPartial(self, out):\n pass", "metadata": "root.StopModuleResponse.OutputPartial", "header": "['class', 'StopModuleResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1509 }, { "content": " def TryMerge(self, d):\n while d.avail() > 0:\n tt = d.getVarInt32()\n\n\n if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError\n d.skipData(tt)", "metadata": "root.StopModuleResponse.TryMerge", "header": "['class', 'StopModuleResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1512 }, { "content": " def __str__(self, prefix=\"\", printElemNumber=0):\n res=\"\"\n return res", "metadata": "root.StopModuleResponse.__str__", "header": "['class', 'StopModuleResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1521 }, { "content": " def _BuildTagLookupTable(sparse, maxtag, default=None):\n return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])", "metadata": "root.StopModuleResponse._BuildTagLookupTable", "header": "['class', 'StopModuleResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1526 }, { "content": "class GetHostnameRequest(ProtocolBuffer.ProtocolMessage):\n has_module_ = 0\n module_ = \"\"\n has_version_ = 0\n version_ = \"\"\n has_instance_ = 0\n instance_ = \"\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n kmodule = 1\n kversion = 2\n kinstance = 3\n\n _TEXT = _BuildTagLookupTable({\n 0: \"ErrorCode\",\n 1: \"module\",\n 2: \"version\",\n 3: \"instance\",\n }, 3)\n\n _TYPES = _BuildTagLookupTable({\n 0: ProtocolBuffer.Encoder.NUMERIC,\n 1: ProtocolBuffer.Encoder.STRING,\n 2: ProtocolBuffer.Encoder.STRING,\n 3: ProtocolBuffer.Encoder.STRING,\n }, 3, ProtocolBuffer.Encoder.MAX_TYPE)\n\n\n _STYLE = \"\"\"\"\"\"\n _STYLE_CONTENT_TYPE = \"\"\"\"\"\"\n _PROTO_DESCRIPTOR_NAME = 'apphosting.GetHostnameRequest'", "metadata": "root.GetHostnameRequest", "header": "['module', '___EOS___']", "index": 1542 }, { "content": " def __init__(self, contents=None):\n if contents is not None: self.MergeFromString(contents)", "metadata": "root.GetHostnameRequest.__init__", "header": "['class', 'GetHostnameRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1550 }, { "content": " def module(self): return self.module_", "metadata": "root.GetHostnameRequest.module", "header": "['class', 'GetHostnameRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1553 }, { "content": " def set_module(self, x):\n self.has_module_ = 1\n self.module_ = x", "metadata": "root.GetHostnameRequest.set_module", "header": "['class', 'GetHostnameRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1555 }, { "content": " def clear_module(self):\n if self.has_module_:\n self.has_module_ = 0\n self.module_ = \"\"", "metadata": "root.GetHostnameRequest.clear_module", "header": "['class', 'GetHostnameRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1559 }, { "content": " def has_module(self): return self.has_module_", "metadata": "root.GetHostnameRequest.has_module", "header": "['class', 'GetHostnameRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1564 }, { "content": " def version(self): return self.version_", "metadata": "root.GetHostnameRequest.version", "header": "['class', 'GetHostnameRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1566 }, { "content": " def set_version(self, x):\n self.has_version_ = 1\n self.version_ = x", "metadata": "root.GetHostnameRequest.set_version", "header": "['class', 'GetHostnameRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1568 }, { "content": " def clear_version(self):\n if self.has_version_:\n self.has_version_ = 0\n self.version_ = \"\"", "metadata": "root.GetHostnameRequest.clear_version", "header": "['class', 'GetHostnameRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1572 }, { "content": " def has_version(self): return self.has_version_", "metadata": "root.GetHostnameRequest.has_version", "header": "['class', 'GetHostnameRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1577 }, { "content": " def instance(self): return self.instance_", "metadata": "root.GetHostnameRequest.instance", "header": "['class', 'GetHostnameRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1579 }, { "content": " def set_instance(self, x):\n self.has_instance_ = 1\n self.instance_ = x", "metadata": "root.GetHostnameRequest.set_instance", "header": "['class', 'GetHostnameRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1581 }, { "content": " def clear_instance(self):\n if self.has_instance_:\n self.has_instance_ = 0\n self.instance_ = \"\"", "metadata": "root.GetHostnameRequest.clear_instance", "header": "['class', 'GetHostnameRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1585 }, { "content": " def has_instance(self): return self.has_instance_", "metadata": "root.GetHostnameRequest.has_instance", "header": "['class', 'GetHostnameRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1590 }, { "content": " def MergeFrom(self, x):\n assert x is not self\n if (x.has_module()): self.set_module(x.module())\n if (x.has_version()): self.set_version(x.version())\n if (x.has_instance()): self.set_instance(x.instance())", "metadata": "root.GetHostnameRequest.MergeFrom", "header": "['class', 'GetHostnameRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1593 }, { "content": " def Equals(self, x):\n if x is self: return 1\n if self.has_module_ != x.has_module_: return 0\n if self.has_module_ and self.module_ != x.module_: return 0\n if self.has_version_ != x.has_version_: return 0\n if self.has_version_ and self.version_ != x.version_: return 0\n if self.has_instance_ != x.has_instance_: return 0\n if self.has_instance_ and self.instance_ != x.instance_: return 0\n return 1", "metadata": "root.GetHostnameRequest.Equals", "header": "['class', 'GetHostnameRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1599 }, { "content": " def IsInitialized(self, debug_strs=None):\n initialized = 1\n return initialized", "metadata": "root.GetHostnameRequest.IsInitialized", "header": "['class', 'GetHostnameRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1609 }, { "content": " def ByteSize(self):\n n = 0\n if (self.has_module_): n += 1 + self.lengthString(len(self.module_))\n if (self.has_version_): n += 1 + self.lengthString(len(self.version_))\n if (self.has_instance_): n += 1 + self.lengthString(len(self.instance_))\n return n", "metadata": "root.GetHostnameRequest.ByteSize", "header": "['class', 'GetHostnameRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1613 }, { "content": " def ByteSizePartial(self):\n n = 0\n if (self.has_module_): n += 1 + self.lengthString(len(self.module_))\n if (self.has_version_): n += 1 + self.lengthString(len(self.version_))\n if (self.has_instance_): n += 1 + self.lengthString(len(self.instance_))\n return n", "metadata": "root.GetHostnameRequest.ByteSizePartial", "header": "['class', 'GetHostnameRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1620 }, { "content": " def Clear(self):\n self.clear_module()\n self.clear_version()\n self.clear_instance()", "metadata": "root.GetHostnameRequest.Clear", "header": "['class', 'GetHostnameRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1627 }, { "content": " def OutputUnchecked(self, out):\n if (self.has_module_):\n out.putVarInt32(10)\n out.putPrefixedString(self.module_)\n if (self.has_version_):\n out.putVarInt32(18)\n out.putPrefixedString(self.version_)\n if (self.has_instance_):\n out.putVarInt32(26)\n out.putPrefixedString(self.instance_)", "metadata": "root.GetHostnameRequest.OutputUnchecked", "header": "['class', 'GetHostnameRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1632 }, { "content": " def OutputPartial(self, out):\n if (self.has_module_):\n out.putVarInt32(10)\n out.putPrefixedString(self.module_)\n if (self.has_version_):\n out.putVarInt32(18)\n out.putPrefixedString(self.version_)\n if (self.has_instance_):\n out.putVarInt32(26)\n out.putPrefixedString(self.instance_)", "metadata": "root.GetHostnameRequest.OutputPartial", "header": "['class', 'GetHostnameRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1643 }, { "content": " def TryMerge(self, d):\n while d.avail() > 0:\n tt = d.getVarInt32()\n if tt == 10:\n self.set_module(d.getPrefixedString())\n continue\n if tt == 18:\n self.set_version(d.getPrefixedString())\n continue\n if tt == 26:\n self.set_instance(d.getPrefixedString())\n continue\n\n\n if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError\n d.skipData(tt)", "metadata": "root.GetHostnameRequest.TryMerge", "header": "['class', 'GetHostnameRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1654 }, { "content": " def __str__(self, prefix=\"\", printElemNumber=0):\n res=\"\"\n if self.has_module_: res+=prefix+(\"module: %s\\n\" % self.DebugFormatString(self.module_))\n if self.has_version_: res+=prefix+(\"version: %s\\n\" % self.DebugFormatString(self.version_))\n if self.has_instance_: res+=prefix+(\"instance: %s\\n\" % self.DebugFormatString(self.instance_))\n return res", "metadata": "root.GetHostnameRequest.__str__", "header": "['class', 'GetHostnameRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1672 }, { "content": " def _BuildTagLookupTable(sparse, maxtag, default=None):\n return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])", "metadata": "root.GetHostnameRequest._BuildTagLookupTable", "header": "['class', 'GetHostnameRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1680 }, { "content": "class GetHostnameResponse(ProtocolBuffer.ProtocolMessage):\n has_hostname_ = 0\n hostname_ = \"\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n khostname = 1\n\n _TEXT = _BuildTagLookupTable({\n 0: \"ErrorCode\",\n 1: \"hostname\",\n }, 1)\n\n _TYPES = _BuildTagLookupTable({\n 0: ProtocolBuffer.Encoder.NUMERIC,\n 1: ProtocolBuffer.Encoder.STRING,\n }, 1, ProtocolBuffer.Encoder.MAX_TYPE)\n\n\n _STYLE = \"\"\"\"\"\"\n _STYLE_CONTENT_TYPE = \"\"\"\"\"\"\n _PROTO_DESCRIPTOR_NAME = 'apphosting.GetHostnameResponse'", "metadata": "root.GetHostnameResponse", "header": "['module', '___EOS___']", "index": 1705 }, { "content": " def __init__(self, contents=None):\n if contents is not None: self.MergeFromString(contents)", "metadata": "root.GetHostnameResponse.__init__", "header": "['class', 'GetHostnameResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1709 }, { "content": " def hostname(self): return self.hostname_", "metadata": "root.GetHostnameResponse.hostname", "header": "['class', 'GetHostnameResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1712 }, { "content": " def set_hostname(self, x):\n self.has_hostname_ = 1\n self.hostname_ = x", "metadata": "root.GetHostnameResponse.set_hostname", "header": "['class', 'GetHostnameResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1714 }, { "content": " def clear_hostname(self):\n if self.has_hostname_:\n self.has_hostname_ = 0\n self.hostname_ = \"\"", "metadata": "root.GetHostnameResponse.clear_hostname", "header": "['class', 'GetHostnameResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1718 }, { "content": " def has_hostname(self): return self.has_hostname_", "metadata": "root.GetHostnameResponse.has_hostname", "header": "['class', 'GetHostnameResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1723 }, { "content": " def MergeFrom(self, x):\n assert x is not self\n if (x.has_hostname()): self.set_hostname(x.hostname())", "metadata": "root.GetHostnameResponse.MergeFrom", "header": "['class', 'GetHostnameResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1726 }, { "content": " def Equals(self, x):\n if x is self: return 1\n if self.has_hostname_ != x.has_hostname_: return 0\n if self.has_hostname_ and self.hostname_ != x.hostname_: return 0\n return 1", "metadata": "root.GetHostnameResponse.Equals", "header": "['class', 'GetHostnameResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1730 }, { "content": " def IsInitialized(self, debug_strs=None):\n initialized = 1\n if (not self.has_hostname_):\n initialized = 0\n if debug_strs is not None:\n debug_strs.append('Required field: hostname not set.')\n return initialized", "metadata": "root.GetHostnameResponse.IsInitialized", "header": "['class', 'GetHostnameResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1736 }, { "content": " def ByteSize(self):\n n = 0\n n += self.lengthString(len(self.hostname_))\n return n + 1", "metadata": "root.GetHostnameResponse.ByteSize", "header": "['class', 'GetHostnameResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1744 }, { "content": " def ByteSizePartial(self):\n n = 0\n if (self.has_hostname_):\n n += 1\n n += self.lengthString(len(self.hostname_))\n return n", "metadata": "root.GetHostnameResponse.ByteSizePartial", "header": "['class', 'GetHostnameResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1749 }, { "content": " def Clear(self):\n self.clear_hostname()", "metadata": "root.GetHostnameResponse.Clear", "header": "['class', 'GetHostnameResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1756 }, { "content": " def OutputUnchecked(self, out):\n out.putVarInt32(10)\n out.putPrefixedString(self.hostname_)", "metadata": "root.GetHostnameResponse.OutputUnchecked", "header": "['class', 'GetHostnameResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1759 }, { "content": " def OutputPartial(self, out):\n if (self.has_hostname_):\n out.putVarInt32(10)\n out.putPrefixedString(self.hostname_)", "metadata": "root.GetHostnameResponse.OutputPartial", "header": "['class', 'GetHostnameResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1763 }, { "content": " def TryMerge(self, d):\n while d.avail() > 0:\n tt = d.getVarInt32()\n if tt == 10:\n self.set_hostname(d.getPrefixedString())\n continue\n\n\n if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError\n d.skipData(tt)", "metadata": "root.GetHostnameResponse.TryMerge", "header": "['class', 'GetHostnameResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1768 }, { "content": " def __str__(self, prefix=\"\", printElemNumber=0):\n res=\"\"\n if self.has_hostname_: res+=prefix+(\"hostname: %s\\n\" % self.DebugFormatString(self.hostname_))\n return res", "metadata": "root.GetHostnameResponse.__str__", "header": "['class', 'GetHostnameResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1780 }, { "content": " def _BuildTagLookupTable(sparse, maxtag, default=None):\n return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])", "metadata": "root.GetHostnameResponse._BuildTagLookupTable", "header": "['class', 'GetHostnameResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 1786 } ]
[ { "span": "import array", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 12 }, { "span": "import dummy_thread as thread", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 29 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2007", " ", "Goo", "gle", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "google_", "._", "net_", "._", "proto_", "import_", "Proto", "col", "Buffer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "dummy", "\\u", "thread_", "as_", "thread_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "pyche", "cker", "\\u\\u_", "=_", "\"\"\"", "maxr", "etu", "rn", "s", "=", "0", " ", "max", "branch", "es", "=", "0", " ", "no", "-", "call", "init", "\\", "10", ";", " ", "unu", "sed", "names", "=", "print", "Ele", "m", "Number", ",", "debug", "\\u", "strs", " ", "no", "-", "special", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "Proto", "col", "Buffer_", ",_", "'", "Extend", "able", "Proto", "col", "Messag", "e", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "extensi", "on", "\\u", "runtime_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "Extend", "able", "Proto", "col", "Message_", "=_", "Proto", "col", "Buffer_", "._", "Extend", "able", "Proto", "col", "Message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "extensi", "on", "\\u", "runtime_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "Extend", "able", "Proto", "col", "Message_", "=_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "extensi", "on", "\\u", "runtime_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "Modul", "es", "Service", "Error", "'_", ",_", "'", "Get", "Modul", "es", "Request", "'_", ",_", "'", "Get", "Modul", "es", "Respons", "e", "'_", ",_", "'", "Get", "Version", "s", "Request", "'_", ",_", "'", "Get", "Version", "s", "Respons", "e", "'_", ",_", "'", "Get", "Default", "Version", "Request", "'_", ",_", "'", "Get", "Default", "Version", "Respons", "e", "'_", ",_", "'", "Get", "Num", "Insta", "nce", "s", "Request", "'_", ",_", "'", "Get", "Num", "Insta", "nce", "s", "Respons", "e", "'_", ",_", "'", "Set", "Num", "Insta", "nce", "s", "Request", "'_", ",_", "'", "Set", "Num", "Insta", "nce", "s", "Respons", "e", "'_", ",_", "'", "Start", "Modul", "e", "Request", "'_", ",_", "'", "Start", "Modul", "e", "Respons", "e", "'_", ",_", "'", "Sto", "p", "Modul", "e", "Request", "'_", ",_", "'", "Sto", "p", "Modul", "e", "Respons", "e", "'_", ",_", "'", "Get", "Host", "name", "Request", "'_", ",_", "'", "Get", "Host", "name", "Respons", "e", "'_", "]_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Modul", "es", "Service", "Error_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "OK_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INVALID", "\\u", "MODULE_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INVALID", "\\u", "VERSION_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INVALID", "\\u", "INSTANCE", "S_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TRANS", "IENT", "\\u", "ERROR_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "UNE", "XP", "ECTED", "\\u", "STATE_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Error", "Code", "\\u", "NAMES_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "\"", "OK", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "\"", "INVALID", "\\u", "MODUL", "E", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "\"", "INVALID", "\\u", "VERSI", "ON", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "3_", ":_", "\"", "INVALID", "\\u", "INSTANCE", "S", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "4_", ":_", "\"", "TRANS", "IENT", "\\u", "ERROR", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "5_", ":_", "\"", "UNE", "XP", "ECTED", "\\u", "STATE", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Error", "Code", "\\u", "Name_", "=_", "classmethod_", "(_", "Error", "Code", "\\u", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "TEXT_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "\"", "Error", "Code", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TYPES_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "0_", ",_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "MAX", "\\u", "TYPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "STYLE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "STYLE", "\\u", "CONTE", "NT", "\\u", "TYPE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PROTO", "\\u", "DESCRIPT", "OR", "\\u", "NAME_", "=_", "'", "app", "hostin", "g", ".", "Modul", "es", "Service", "Error", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Modul", "es", "Service", "Error_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Error", "Code", "\\u", "Name_", "(_", "cls_", ",_", "x_", ")_", ":_", "return_", "cls_", "._", "\\u", "Error", "Code", "\\u", "NAMES_", "._", "get_", "(_", "x_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Modul", "es", "Service", "Error_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "contents_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "contents_", "is_", "not_", "None_", ":_", "self_", "._", "Merge", "Fro", "m", "String_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Modul", "es", "Service", "Error_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Merge", "From_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "x_", "is_", "not_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Modul", "es", "Service", "Error_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Equals_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "is_", "self_", ":_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Modul", "es", "Service", "Error_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Is", "Initialized", "_", "(_", "self_", ",_", "debug", "\\u", "strs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "initialized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Modul", "es", "Service", "Error_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Modul", "es", "Service", "Error_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size", "Parti", "al_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Modul", "es", "Service", "Error_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Modul", "es", "Service", "Error_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Unc", "heck", "ed_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Modul", "es", "Service", "Error_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Parti", "al_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Modul", "es", "Service", "Error_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Tr", "y", "Merge_", "(_", "self_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "d_", "._", "avail_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tt_", "=_", "d_", "._", "get", "Var", "Int32_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "tt_", "==_", "0_", ")_", ":_", "raise_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Buffer", "Decode", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "skip", "Data_", "(_", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Modul", "es", "Service", "Error_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ",_", "prefix_", "=_", "\"\"_", ",_", "print", "Ele", "m", "Number_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Modul", "es", "Service", "Error_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "sparse_", ",_", "maxt", "ag_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tuple_", "(_", "[_", "sparse_", "._", "get_", "(_", "i_", ",_", "default_", ")_", "for_", "i_", "in_", "xrange_", "(_", "0_", ",_", "1_", "+_", "maxt", "ag_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Get", "Modul", "es", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "TEXT_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "\"", "Error", "Code", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TYPES_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "0_", ",_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "MAX", "\\u", "TYPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "STYLE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "STYLE", "\\u", "CONTE", "NT", "\\u", "TYPE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PROTO", "\\u", "DESCRIPT", "OR", "\\u", "NAME_", "=_", "'", "app", "hostin", "g", ".", "Get", "Modul", "es", "Request", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "contents_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "contents_", "is_", "not_", "None_", ":_", "self_", "._", "Merge", "Fro", "m", "String_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Merge", "From_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "x_", "is_", "not_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Equals_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "is_", "self_", ":_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Is", "Initialized", "_", "(_", "self_", ",_", "debug", "\\u", "strs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "initialized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size", "Parti", "al_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Unc", "heck", "ed_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Parti", "al_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Tr", "y", "Merge_", "(_", "self_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "d_", "._", "avail_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tt_", "=_", "d_", "._", "get", "Var", "Int32_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "tt_", "==_", "0_", ")_", ":_", "raise_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Buffer", "Decode", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "skip", "Data_", "(_", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ",_", "prefix_", "=_", "\"\"_", ",_", "print", "Ele", "m", "Number_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "sparse_", ",_", "maxt", "ag_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tuple_", "(_", "[_", "sparse_", "._", "get_", "(_", "i_", ",_", "default_", ")_", "for_", "i_", "in_", "xrange_", "(_", "0_", ",_", "1_", "+_", "maxt", "ag_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Get", "Modul", "es", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "km", "odule_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TEXT_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "\"", "Error", "Code", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "\"", "module", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TYPES_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "1_", ",_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "MAX", "\\u", "TYPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "STYLE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "STYLE", "\\u", "CONTE", "NT", "\\u", "TYPE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PROTO", "\\u", "DESCRIPT", "OR", "\\u", "NAME_", "=_", "'", "app", "hostin", "g", ".", "Get", "Modul", "es", "Respons", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "contents_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "module", "\\u_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "contents_", "is_", "not_", "None_", ":_", "self_", "._", "Merge", "Fro", "m", "String_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "module", "\\u", "size_", "(_", "self_", ")_", ":_", "return_", "len_", "(_", "self_", "._", "module", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "module", "\\u", "list_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "module", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "module_", "(_", "self_", ",_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "module", "\\u_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "module_", "(_", "self_", ",_", "i_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "module", "\\u_", "[_", "i_", "]_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "module_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "module", "\\u_", "._", "append_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "module_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "module", "\\u_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Merge", "From_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "x_", "is_", "not_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "x_", "._", "module", "\\u", "size_", "(_", ")_", ")_", ":_", "self_", "._", "add", "\\u", "module_", "(_", "x_", "._", "module_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Equals_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "is_", "self_", ":_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "module", "\\u_", ")_", "!=_", "len_", "(_", "x_", "._", "module", "\\u_", ")_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "e1_", ",_", "e2_", "in_", "zip_", "(_", "self_", "._", "module", "\\u_", ",_", "x_", "._", "module", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e1_", "!=_", "e2_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Is", "Initialized", "_", "(_", "self_", ",_", "debug", "\\u", "strs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "initialized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "+=_", "1_", "*_", "len_", "(_", "self_", "._", "module", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "self_", "._", "module", "\\u_", ")_", ")_", ":_", "n_", "+=_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "module", "\\u_", "[_", "i_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size", "Parti", "al_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "+=_", "1_", "*_", "len_", "(_", "self_", "._", "module", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "self_", "._", "module", "\\u_", ")_", ")_", ":_", "n_", "+=_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "module", "\\u_", "[_", "i_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "clear", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Unc", "heck", "ed_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "self_", "._", "module", "\\u_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "module", "\\u_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Parti", "al_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "self_", "._", "module", "\\u_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "module", "\\u_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Tr", "y", "Merge_", "(_", "self_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "d_", "._", "avail_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tt_", "=_", "d_", "._", "get", "Var", "Int32_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tt_", "==_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "module_", "(_", "d_", "._", "get", "Prefixe", "d", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "tt_", "==_", "0_", ")_", ":_", "raise_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Buffer", "Decode", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "skip", "Data_", "(_", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ",_", "prefix_", "=_", "\"\"_", ",_", "print", "Ele", "m", "Number_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cnt_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "e_", "in_", "self_", "._", "module", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "elm_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "print", "Ele", "m", "Number_", ":_", "elm_", "=_", "\"(", "%", "d", ")\"_", "%_", "cnt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "module", "%", "s", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "elm_", ",_", "self_", "._", "Deb", "ug", "Format", "String_", "(_", "e_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cnt_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Modul", "es", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "sparse_", ",_", "maxt", "ag_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tuple_", "(_", "[_", "sparse_", "._", "get_", "(_", "i_", ",_", "default_", ")_", "for_", "i_", "in_", "xrange_", "(_", "0_", ",_", "1_", "+_", "maxt", "ag_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Get", "Version", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "\\u", "module", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "km", "odule_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TEXT_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "\"", "Error", "Code", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "\"", "module", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TYPES_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "1_", ",_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "MAX", "\\u", "TYPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "STYLE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "STYLE", "\\u", "CONTE", "NT", "\\u", "TYPE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PROTO", "\\u", "DESCRIPT", "OR", "\\u", "NAME_", "=_", "'", "app", "hostin", "g", ".", "Get", "Version", "s", "Request", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "contents_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "contents_", "is_", "not_", "None_", ":_", "self_", "._", "Merge", "Fro", "m", "String_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "module_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "module", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "module_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "module", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "module", "\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "module_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "module", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "module", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "module", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "module_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "module", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Merge", "From_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "x_", "is_", "not_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "module_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "module_", "(_", "x_", "._", "module_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Equals_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "is_", "self_", ":_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "module", "\\u_", "!=_", "x_", "._", "has", "\\u", "module", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "module", "\\u_", "and_", "self_", "._", "module", "\\u_", "!=_", "x_", "._", "module", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Is", "Initialized", "_", "(_", "self_", ",_", "debug", "\\u", "strs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "initialized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "module", "\\u_", ")_", ":_", "n_", "+=_", "1_", "+_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "module", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size", "Parti", "al_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "module", "\\u_", ")_", ":_", "n_", "+=_", "1_", "+_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "module", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "clear", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Unc", "heck", "ed_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "has", "\\u", "module", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "module", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Parti", "al_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "has", "\\u", "module", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "module", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Tr", "y", "Merge_", "(_", "self_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "d_", "._", "avail_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tt_", "=_", "d_", "._", "get", "Var", "Int32_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tt_", "==_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "module_", "(_", "d_", "._", "get", "Prefixe", "d", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "tt_", "==_", "0_", ")_", ":_", "raise_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Buffer", "Decode", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "skip", "Data_", "(_", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ",_", "prefix_", "=_", "\"\"_", ",_", "print", "Ele", "m", "Number_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "module", "\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "module", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "String_", "(_", "self_", "._", "module", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "sparse_", ",_", "maxt", "ag_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tuple_", "(_", "[_", "sparse_", "._", "get_", "(_", "i_", ",_", "default_", ")_", "for_", "i_", "in_", "xrange_", "(_", "0_", ",_", "1_", "+_", "maxt", "ag_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Get", "Version", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kv", "ersion_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TEXT_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "\"", "Error", "Code", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "\"", "version", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TYPES_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "1_", ",_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "MAX", "\\u", "TYPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "STYLE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "STYLE", "\\u", "CONTE", "NT", "\\u", "TYPE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PROTO", "\\u", "DESCRIPT", "OR", "\\u", "NAME_", "=_", "'", "app", "hostin", "g", ".", "Get", "Version", "s", "Respons", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "contents_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "version", "\\u_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "contents_", "is_", "not_", "None_", ":_", "self_", "._", "Merge", "Fro", "m", "String_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "version", "\\u", "size_", "(_", "self_", ")_", ":_", "return_", "len_", "(_", "self_", "._", "version", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "version", "\\u", "list_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "version", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "version_", "(_", "self_", ",_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "version", "\\u_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "version_", "(_", "self_", ",_", "i_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "version", "\\u_", "[_", "i_", "]_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "version_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "version", "\\u_", "._", "append_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "version_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "version", "\\u_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Merge", "From_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "x_", "is_", "not_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "x_", "._", "version", "\\u", "size_", "(_", ")_", ")_", ":_", "self_", "._", "add", "\\u", "version_", "(_", "x_", "._", "version_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Equals_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "is_", "self_", ":_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "version", "\\u_", ")_", "!=_", "len_", "(_", "x_", "._", "version", "\\u_", ")_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "e1_", ",_", "e2_", "in_", "zip_", "(_", "self_", "._", "version", "\\u_", ",_", "x_", "._", "version", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e1_", "!=_", "e2_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Is", "Initialized", "_", "(_", "self_", ",_", "debug", "\\u", "strs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "initialized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "+=_", "1_", "*_", "len_", "(_", "self_", "._", "version", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "self_", "._", "version", "\\u_", ")_", ")_", ":_", "n_", "+=_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "version", "\\u_", "[_", "i_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size", "Parti", "al_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "+=_", "1_", "*_", "len_", "(_", "self_", "._", "version", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "self_", "._", "version", "\\u_", ")_", ")_", ":_", "n_", "+=_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "version", "\\u_", "[_", "i_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "clear", "\\u", "version_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Unc", "heck", "ed_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "self_", "._", "version", "\\u_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "version", "\\u_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Parti", "al_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "self_", "._", "version", "\\u_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "version", "\\u_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Tr", "y", "Merge_", "(_", "self_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "d_", "._", "avail_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tt_", "=_", "d_", "._", "get", "Var", "Int32_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tt_", "==_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "version_", "(_", "d_", "._", "get", "Prefixe", "d", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "tt_", "==_", "0_", ")_", ":_", "raise_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Buffer", "Decode", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "skip", "Data_", "(_", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ",_", "prefix_", "=_", "\"\"_", ",_", "print", "Ele", "m", "Number_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cnt_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "e_", "in_", "self_", "._", "version", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "elm_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "print", "Ele", "m", "Number_", ":_", "elm_", "=_", "\"(", "%", "d", ")\"_", "%_", "cnt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "version", "%", "s", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "elm_", ",_", "self_", "._", "Deb", "ug", "Format", "String_", "(_", "e_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cnt_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Version", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "sparse_", ",_", "maxt", "ag_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tuple_", "(_", "[_", "sparse_", "._", "get_", "(_", "i_", ",_", "default_", ")_", "for_", "i_", "in_", "xrange_", "(_", "0_", ",_", "1_", "+_", "maxt", "ag_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Get", "Default", "Version", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "\\u", "module", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "km", "odule_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TEXT_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "\"", "Error", "Code", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "\"", "module", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TYPES_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "1_", ",_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "MAX", "\\u", "TYPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "STYLE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "STYLE", "\\u", "CONTE", "NT", "\\u", "TYPE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PROTO", "\\u", "DESCRIPT", "OR", "\\u", "NAME_", "=_", "'", "app", "hostin", "g", ".", "Get", "Default", "Version", "Request", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "contents_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "contents_", "is_", "not_", "None_", ":_", "self_", "._", "Merge", "Fro", "m", "String_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "module_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "module", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "module_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "module", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "module", "\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "module_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "module", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "module", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "module", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "module_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "module", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Merge", "From_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "x_", "is_", "not_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "module_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "module_", "(_", "x_", "._", "module_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Equals_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "is_", "self_", ":_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "module", "\\u_", "!=_", "x_", "._", "has", "\\u", "module", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "module", "\\u_", "and_", "self_", "._", "module", "\\u_", "!=_", "x_", "._", "module", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Is", "Initialized", "_", "(_", "self_", ",_", "debug", "\\u", "strs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "initialized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "module", "\\u_", ")_", ":_", "n_", "+=_", "1_", "+_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "module", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size", "Parti", "al_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "module", "\\u_", ")_", ":_", "n_", "+=_", "1_", "+_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "module", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "clear", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Unc", "heck", "ed_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "has", "\\u", "module", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "module", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Parti", "al_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "has", "\\u", "module", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "module", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Tr", "y", "Merge_", "(_", "self_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "d_", "._", "avail_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tt_", "=_", "d_", "._", "get", "Var", "Int32_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tt_", "==_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "module_", "(_", "d_", "._", "get", "Prefixe", "d", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "tt_", "==_", "0_", ")_", ":_", "raise_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Buffer", "Decode", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "skip", "Data_", "(_", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ",_", "prefix_", "=_", "\"\"_", ",_", "print", "Ele", "m", "Number_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "module", "\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "module", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "String_", "(_", "self_", "._", "module", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "sparse_", ",_", "maxt", "ag_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tuple_", "(_", "[_", "sparse_", "._", "get_", "(_", "i_", ",_", "default_", ")_", "for_", "i_", "in_", "xrange_", "(_", "0_", ",_", "1_", "+_", "maxt", "ag_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Get", "Default", "Version", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "\\u", "version", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kv", "ersion_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TEXT_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "\"", "Error", "Code", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "\"", "version", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TYPES_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "1_", ",_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "MAX", "\\u", "TYPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "STYLE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "STYLE", "\\u", "CONTE", "NT", "\\u", "TYPE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PROTO", "\\u", "DESCRIPT", "OR", "\\u", "NAME_", "=_", "'", "app", "hostin", "g", ".", "Get", "Default", "Version", "Respons", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "contents_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "contents_", "is_", "not_", "None_", ":_", "self_", "._", "Merge", "Fro", "m", "String_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "version_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "version", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "version_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "version", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "version", "\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "version_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "version", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "version", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "version", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "version_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "version", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Merge", "From_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "x_", "is_", "not_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "version_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "version_", "(_", "x_", "._", "version_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Equals_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "is_", "self_", ":_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "version", "\\u_", "!=_", "x_", "._", "has", "\\u", "version", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "version", "\\u_", "and_", "self_", "._", "version", "\\u_", "!=_", "x_", "._", "version", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Is", "Initialized", "_", "(_", "self_", ",_", "debug", "\\u", "strs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "self_", "._", "has", "\\u", "version", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "debug", "\\u", "strs_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "debug", "\\u", "strs_", "._", "append_", "(_", "'", "Requ", "ired", " ", "field", ":", " ", "version", " ", "not", " ", "set", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "initialized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "+=_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "version", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size", "Parti", "al_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "version", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "+=_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "version", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "clear", "\\u", "version_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Unc", "heck", "ed_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "version", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Parti", "al_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "has", "\\u", "version", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "version", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Tr", "y", "Merge_", "(_", "self_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "d_", "._", "avail_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tt_", "=_", "d_", "._", "get", "Var", "Int32_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tt_", "==_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "version_", "(_", "d_", "._", "get", "Prefixe", "d", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "tt_", "==_", "0_", ")_", ":_", "raise_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Buffer", "Decode", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "skip", "Data_", "(_", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ",_", "prefix_", "=_", "\"\"_", ",_", "print", "Ele", "m", "Number_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "version", "\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "version", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "String_", "(_", "self_", "._", "version", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Default", "Version", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "sparse_", ",_", "maxt", "ag_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tuple_", "(_", "[_", "sparse_", "._", "get_", "(_", "i_", ",_", "default_", ")_", "for_", "i_", "in_", "xrange_", "(_", "0_", ",_", "1_", "+_", "maxt", "ag_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Get", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "\\u", "module", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "version", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "km", "odule_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kv", "ersion_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TEXT_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "\"", "Error", "Code", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "\"", "module", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "\"", "version", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TYPES_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "2_", ",_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "MAX", "\\u", "TYPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "STYLE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "STYLE", "\\u", "CONTE", "NT", "\\u", "TYPE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PROTO", "\\u", "DESCRIPT", "OR", "\\u", "NAME_", "=_", "'", "app", "hostin", "g", ".", "Get", "Num", "Insta", "nce", "s", "Request", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "contents_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "contents_", "is_", "not_", "None_", ":_", "self_", "._", "Merge", "Fro", "m", "String_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "module_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "module", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "module_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "module", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "module", "\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "module_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "module", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "module", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "module", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "module_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "module", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "version_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "version", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "version_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "version", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "version", "\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "version_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "version", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "version", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "version", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "version_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "version", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Merge", "From_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "x_", "is_", "not_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "module_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "module_", "(_", "x_", "._", "module_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "version_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "version_", "(_", "x_", "._", "version_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Equals_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "is_", "self_", ":_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "module", "\\u_", "!=_", "x_", "._", "has", "\\u", "module", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "module", "\\u_", "and_", "self_", "._", "module", "\\u_", "!=_", "x_", "._", "module", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "version", "\\u_", "!=_", "x_", "._", "has", "\\u", "version", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "version", "\\u_", "and_", "self_", "._", "version", "\\u_", "!=_", "x_", "._", "version", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Is", "Initialized", "_", "(_", "self_", ",_", "debug", "\\u", "strs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "initialized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "module", "\\u_", ")_", ":_", "n_", "+=_", "1_", "+_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "module", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "version", "\\u_", ")_", ":_", "n_", "+=_", "1_", "+_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "version", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size", "Parti", "al_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "module", "\\u_", ")_", ":_", "n_", "+=_", "1_", "+_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "module", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "version", "\\u_", ")_", ":_", "n_", "+=_", "1_", "+_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "version", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "clear", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear", "\\u", "version_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Unc", "heck", "ed_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "has", "\\u", "module", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "module", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "version", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "18_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "version", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Parti", "al_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "has", "\\u", "module", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "module", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "version", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "18_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "version", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Tr", "y", "Merge_", "(_", "self_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "d_", "._", "avail_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tt_", "=_", "d_", "._", "get", "Var", "Int32_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tt_", "==_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "module_", "(_", "d_", "._", "get", "Prefixe", "d", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tt_", "==_", "18_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "version_", "(_", "d_", "._", "get", "Prefixe", "d", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "tt_", "==_", "0_", ")_", ":_", "raise_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Buffer", "Decode", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "skip", "Data_", "(_", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ",_", "prefix_", "=_", "\"\"_", ",_", "print", "Ele", "m", "Number_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "module", "\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "module", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "String_", "(_", "self_", "._", "module", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "version", "\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "version", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "String_", "(_", "self_", "._", "version", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "sparse_", ",_", "maxt", "ag_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tuple_", "(_", "[_", "sparse_", "._", "get_", "(_", "i_", ",_", "default_", ")_", "for_", "i_", "in_", "xrange_", "(_", "0_", ",_", "1_", "+_", "maxt", "ag_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Get", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "\\u", "instance", "s\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "s\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kins", "tanc", "es_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TEXT_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "\"", "Error", "Code", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "\"", "instance", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TYPES_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "1_", ",_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "MAX", "\\u", "TYPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "STYLE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "STYLE", "\\u", "CONTE", "NT", "\\u", "TYPE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PROTO", "\\u", "DESCRIPT", "OR", "\\u", "NAME_", "=_", "'", "app", "hostin", "g", ".", "Get", "Num", "Insta", "nce", "s", "Respons", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "contents_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "contents_", "is_", "not_", "None_", ":_", "self_", "._", "Merge", "Fro", "m", "String_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "instances_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "instance", "s\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "instances_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "instance", "s\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "instance", "s\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "instances_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "instance", "s\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "instance", "s\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "instance", "s\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "instances_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "instance", "s\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Merge", "From_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "x_", "is_", "not_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "instances_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "instances_", "(_", "x_", "._", "instances_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Equals_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "is_", "self_", ":_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "instance", "s\\u_", "!=_", "x_", "._", "has", "\\u", "instance", "s\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "instance", "s\\u_", "and_", "self_", "._", "instance", "s\\u_", "!=_", "x_", "._", "instance", "s\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Is", "Initialized", "_", "(_", "self_", ",_", "debug", "\\u", "strs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "self_", "._", "has", "\\u", "instance", "s\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "debug", "\\u", "strs_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "debug", "\\u", "strs_", "._", "append_", "(_", "'", "Requ", "ired", " ", "field", ":", " ", "instance", "s", " ", "not", " ", "set", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "initialized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "+=_", "self_", "._", "length", "Var", "Int64", "_", "(_", "self_", "._", "instance", "s\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size", "Parti", "al_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "instance", "s\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "+=_", "self_", "._", "length", "Var", "Int64", "_", "(_", "self_", "._", "instance", "s\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "clear", "\\u", "instances_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Unc", "heck", "ed_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Var", "Int64", "_", "(_", "self_", "._", "instance", "s\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Parti", "al_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "has", "\\u", "instance", "s\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Var", "Int64", "_", "(_", "self_", "._", "instance", "s\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Tr", "y", "Merge_", "(_", "self_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "d_", "._", "avail_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tt_", "=_", "d_", "._", "get", "Var", "Int32_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tt_", "==_", "8_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "instances_", "(_", "d_", "._", "get", "Var", "Int64", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "tt_", "==_", "0_", ")_", ":_", "raise_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Buffer", "Decode", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "skip", "Data_", "(_", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ",_", "prefix_", "=_", "\"\"_", ",_", "print", "Ele", "m", "Number_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "instance", "s\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "instance", "s", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "Int64", "_", "(_", "self_", "._", "instance", "s\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "sparse_", ",_", "maxt", "ag_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tuple_", "(_", "[_", "sparse_", "._", "get_", "(_", "i_", ",_", "default_", ")_", "for_", "i_", "in_", "xrange_", "(_", "0_", ",_", "1_", "+_", "maxt", "ag_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Set", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "\\u", "module", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "version", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "instance", "s\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "s\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "km", "odule_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kv", "ersion_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kins", "tanc", "es_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TEXT_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "\"", "Error", "Code", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "\"", "module", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "\"", "version", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "3_", ":_", "\"", "instance", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TYPES_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "3_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "3_", ",_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "MAX", "\\u", "TYPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "STYLE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "STYLE", "\\u", "CONTE", "NT", "\\u", "TYPE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PROTO", "\\u", "DESCRIPT", "OR", "\\u", "NAME_", "=_", "'", "app", "hostin", "g", ".", "Set", "Num", "Insta", "nce", "s", "Request", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "contents_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "contents_", "is_", "not_", "None_", ":_", "self_", "._", "Merge", "Fro", "m", "String_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "module_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "module", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "module_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "module", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "module", "\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "module_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "module", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "module", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "module", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "module_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "module", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "version_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "version", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "version_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "version", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "version", "\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "version_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "version", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "version", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "version", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "version_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "version", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "instances_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "instance", "s\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "instances_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "instance", "s\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "instance", "s\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "instances_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "instance", "s\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "instance", "s\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "instance", "s\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "instances_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "instance", "s\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Merge", "From_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "x_", "is_", "not_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "module_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "module_", "(_", "x_", "._", "module_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "version_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "version_", "(_", "x_", "._", "version_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "instances_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "instances_", "(_", "x_", "._", "instances_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Equals_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "is_", "self_", ":_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "module", "\\u_", "!=_", "x_", "._", "has", "\\u", "module", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "module", "\\u_", "and_", "self_", "._", "module", "\\u_", "!=_", "x_", "._", "module", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "version", "\\u_", "!=_", "x_", "._", "has", "\\u", "version", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "version", "\\u_", "and_", "self_", "._", "version", "\\u_", "!=_", "x_", "._", "version", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "instance", "s\\u_", "!=_", "x_", "._", "has", "\\u", "instance", "s\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "instance", "s\\u_", "and_", "self_", "._", "instance", "s\\u_", "!=_", "x_", "._", "instance", "s\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Is", "Initialized", "_", "(_", "self_", ",_", "debug", "\\u", "strs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "self_", "._", "has", "\\u", "instance", "s\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "debug", "\\u", "strs_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "debug", "\\u", "strs_", "._", "append_", "(_", "'", "Requ", "ired", " ", "field", ":", " ", "instance", "s", " ", "not", " ", "set", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "initialized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "module", "\\u_", ")_", ":_", "n_", "+=_", "1_", "+_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "module", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "version", "\\u_", ")_", ":_", "n_", "+=_", "1_", "+_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "version", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "+=_", "self_", "._", "length", "Var", "Int64", "_", "(_", "self_", "._", "instance", "s\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size", "Parti", "al_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "module", "\\u_", ")_", ":_", "n_", "+=_", "1_", "+_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "module", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "version", "\\u_", ")_", ":_", "n_", "+=_", "1_", "+_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "version", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "instance", "s\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "+=_", "self_", "._", "length", "Var", "Int64", "_", "(_", "self_", "._", "instance", "s\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "clear", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear", "\\u", "version_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear", "\\u", "instances_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Unc", "heck", "ed_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "has", "\\u", "module", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "module", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "version", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "18_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "version", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out_", "._", "put", "Var", "Int32_", "(_", "24_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Var", "Int64", "_", "(_", "self_", "._", "instance", "s\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Parti", "al_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "has", "\\u", "module", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "module", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "version", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "18_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "version", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "instance", "s\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "24_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Var", "Int64", "_", "(_", "self_", "._", "instance", "s\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Tr", "y", "Merge_", "(_", "self_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "d_", "._", "avail_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tt_", "=_", "d_", "._", "get", "Var", "Int32_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tt_", "==_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "module_", "(_", "d_", "._", "get", "Prefixe", "d", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tt_", "==_", "18_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "version_", "(_", "d_", "._", "get", "Prefixe", "d", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tt_", "==_", "24_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "instances_", "(_", "d_", "._", "get", "Var", "Int64", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "tt_", "==_", "0_", ")_", ":_", "raise_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Buffer", "Decode", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "skip", "Data_", "(_", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ",_", "prefix_", "=_", "\"\"_", ",_", "print", "Ele", "m", "Number_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "module", "\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "module", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "String_", "(_", "self_", "._", "module", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "version", "\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "version", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "String_", "(_", "self_", "._", "version", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "instance", "s\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "instance", "s", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "Int64", "_", "(_", "self_", "._", "instance", "s\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "sparse_", ",_", "maxt", "ag_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tuple_", "(_", "[_", "sparse_", "._", "get_", "(_", "i_", ",_", "default_", ")_", "for_", "i_", "in_", "xrange_", "(_", "0_", ",_", "1_", "+_", "maxt", "ag_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Set", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "TEXT_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "\"", "Error", "Code", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TYPES_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "0_", ",_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "MAX", "\\u", "TYPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "STYLE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "STYLE", "\\u", "CONTE", "NT", "\\u", "TYPE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PROTO", "\\u", "DESCRIPT", "OR", "\\u", "NAME_", "=_", "'", "app", "hostin", "g", ".", "Set", "Num", "Insta", "nce", "s", "Respons", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "contents_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "contents_", "is_", "not_", "None_", ":_", "self_", "._", "Merge", "Fro", "m", "String_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Merge", "From_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "x_", "is_", "not_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Equals_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "is_", "self_", ":_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Is", "Initialized", "_", "(_", "self_", ",_", "debug", "\\u", "strs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "initialized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size", "Parti", "al_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Unc", "heck", "ed_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Parti", "al_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Tr", "y", "Merge_", "(_", "self_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "d_", "._", "avail_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tt_", "=_", "d_", "._", "get", "Var", "Int32_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "tt_", "==_", "0_", ")_", ":_", "raise_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Buffer", "Decode", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "skip", "Data_", "(_", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ",_", "prefix_", "=_", "\"\"_", ",_", "print", "Ele", "m", "Number_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Num", "Insta", "nce", "s", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "sparse_", ",_", "maxt", "ag_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tuple_", "(_", "[_", "sparse_", "._", "get_", "(_", "i_", ",_", "default_", ")_", "for_", "i_", "in_", "xrange_", "(_", "0_", ",_", "1_", "+_", "maxt", "ag_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Start", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "\\u", "module", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "version", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "km", "odule_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kv", "ersion_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TEXT_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "\"", "Error", "Code", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "\"", "module", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "\"", "version", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TYPES_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "2_", ",_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "MAX", "\\u", "TYPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "STYLE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "STYLE", "\\u", "CONTE", "NT", "\\u", "TYPE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PROTO", "\\u", "DESCRIPT", "OR", "\\u", "NAME_", "=_", "'", "app", "hostin", "g", ".", "Start", "Modul", "e", "Request", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "contents_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "contents_", "is_", "not_", "None_", ":_", "self_", "._", "Merge", "Fro", "m", "String_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "module_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "module", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "module_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "module", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "module", "\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "module_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "module", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "module", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "module", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "module_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "module", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "version_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "version", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "version_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "version", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "version", "\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "version_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "version", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "version", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "version", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "version_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "version", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Merge", "From_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "x_", "is_", "not_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "module_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "module_", "(_", "x_", "._", "module_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "version_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "version_", "(_", "x_", "._", "version_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Equals_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "is_", "self_", ":_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "module", "\\u_", "!=_", "x_", "._", "has", "\\u", "module", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "module", "\\u_", "and_", "self_", "._", "module", "\\u_", "!=_", "x_", "._", "module", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "version", "\\u_", "!=_", "x_", "._", "has", "\\u", "version", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "version", "\\u_", "and_", "self_", "._", "version", "\\u_", "!=_", "x_", "._", "version", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Is", "Initialized", "_", "(_", "self_", ",_", "debug", "\\u", "strs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "self_", "._", "has", "\\u", "module", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "debug", "\\u", "strs_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "debug", "\\u", "strs_", "._", "append_", "(_", "'", "Requ", "ired", " ", "field", ":", " ", "module", " ", "not", " ", "set", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "not_", "self_", "._", "has", "\\u", "version", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "debug", "\\u", "strs_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "debug", "\\u", "strs_", "._", "append_", "(_", "'", "Requ", "ired", " ", "field", ":", " ", "version", " ", "not", " ", "set", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "initialized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "+=_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "module", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "+=_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "version", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "+_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size", "Parti", "al_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "module", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "+=_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "module", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "version", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "+=_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "version", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "clear", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear", "\\u", "version_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Unc", "heck", "ed_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "module", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Var", "Int32_", "(_", "18_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "version", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Parti", "al_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "has", "\\u", "module", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "module", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "version", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "18_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "version", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Tr", "y", "Merge_", "(_", "self_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "d_", "._", "avail_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tt_", "=_", "d_", "._", "get", "Var", "Int32_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tt_", "==_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "module_", "(_", "d_", "._", "get", "Prefixe", "d", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tt_", "==_", "18_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "version_", "(_", "d_", "._", "get", "Prefixe", "d", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "tt_", "==_", "0_", ")_", ":_", "raise_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Buffer", "Decode", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "skip", "Data_", "(_", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ",_", "prefix_", "=_", "\"\"_", ",_", "print", "Ele", "m", "Number_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "module", "\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "module", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "String_", "(_", "self_", "._", "module", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "version", "\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "version", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "String_", "(_", "self_", "._", "version", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "sparse_", ",_", "maxt", "ag_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tuple_", "(_", "[_", "sparse_", "._", "get_", "(_", "i_", ",_", "default_", ")_", "for_", "i_", "in_", "xrange_", "(_", "0_", ",_", "1_", "+_", "maxt", "ag_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Start", "Modul", "e", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "TEXT_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "\"", "Error", "Code", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TYPES_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "0_", ",_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "MAX", "\\u", "TYPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "STYLE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "STYLE", "\\u", "CONTE", "NT", "\\u", "TYPE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PROTO", "\\u", "DESCRIPT", "OR", "\\u", "NAME_", "=_", "'", "app", "hostin", "g", ".", "Start", "Modul", "e", "Respons", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "contents_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "contents_", "is_", "not_", "None_", ":_", "self_", "._", "Merge", "Fro", "m", "String_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Merge", "From_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "x_", "is_", "not_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Equals_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "is_", "self_", ":_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Is", "Initialized", "_", "(_", "self_", ",_", "debug", "\\u", "strs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "initialized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size", "Parti", "al_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Unc", "heck", "ed_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Parti", "al_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Tr", "y", "Merge_", "(_", "self_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "d_", "._", "avail_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tt_", "=_", "d_", "._", "get", "Var", "Int32_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "tt_", "==_", "0_", ")_", ":_", "raise_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Buffer", "Decode", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "skip", "Data_", "(_", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ",_", "prefix_", "=_", "\"\"_", ",_", "print", "Ele", "m", "Number_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Modul", "e", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "sparse_", ",_", "maxt", "ag_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tuple_", "(_", "[_", "sparse_", "._", "get_", "(_", "i_", ",_", "default_", ")_", "for_", "i_", "in_", "xrange_", "(_", "0_", ",_", "1_", "+_", "maxt", "ag_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Sto", "p", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "\\u", "module", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "version", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "km", "odule_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kv", "ersion_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TEXT_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "\"", "Error", "Code", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "\"", "module", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "\"", "version", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TYPES_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "2_", ",_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "MAX", "\\u", "TYPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "STYLE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "STYLE", "\\u", "CONTE", "NT", "\\u", "TYPE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PROTO", "\\u", "DESCRIPT", "OR", "\\u", "NAME_", "=_", "'", "app", "hostin", "g", ".", "Sto", "p", "Modul", "e", "Request", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "contents_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "contents_", "is_", "not_", "None_", ":_", "self_", "._", "Merge", "Fro", "m", "String_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "module_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "module", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "module_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "module", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "module", "\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "module_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "module", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "module", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "module", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "module_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "module", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "version_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "version", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "version_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "version", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "version", "\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "version_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "version", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "version", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "version", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "version_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "version", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Merge", "From_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "x_", "is_", "not_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "module_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "module_", "(_", "x_", "._", "module_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "version_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "version_", "(_", "x_", "._", "version_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Equals_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "is_", "self_", ":_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "module", "\\u_", "!=_", "x_", "._", "has", "\\u", "module", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "module", "\\u_", "and_", "self_", "._", "module", "\\u_", "!=_", "x_", "._", "module", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "version", "\\u_", "!=_", "x_", "._", "has", "\\u", "version", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "version", "\\u_", "and_", "self_", "._", "version", "\\u_", "!=_", "x_", "._", "version", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Is", "Initialized", "_", "(_", "self_", ",_", "debug", "\\u", "strs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "initialized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "module", "\\u_", ")_", ":_", "n_", "+=_", "1_", "+_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "module", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "version", "\\u_", ")_", ":_", "n_", "+=_", "1_", "+_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "version", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size", "Parti", "al_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "module", "\\u_", ")_", ":_", "n_", "+=_", "1_", "+_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "module", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "version", "\\u_", ")_", ":_", "n_", "+=_", "1_", "+_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "version", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "clear", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear", "\\u", "version_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Unc", "heck", "ed_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "has", "\\u", "module", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "module", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "version", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "18_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "version", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Parti", "al_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "has", "\\u", "module", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "module", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "version", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "18_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "version", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Tr", "y", "Merge_", "(_", "self_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "d_", "._", "avail_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tt_", "=_", "d_", "._", "get", "Var", "Int32_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tt_", "==_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "module_", "(_", "d_", "._", "get", "Prefixe", "d", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tt_", "==_", "18_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "version_", "(_", "d_", "._", "get", "Prefixe", "d", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "tt_", "==_", "0_", ")_", ":_", "raise_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Buffer", "Decode", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "skip", "Data_", "(_", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ",_", "prefix_", "=_", "\"\"_", ",_", "print", "Ele", "m", "Number_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "module", "\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "module", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "String_", "(_", "self_", "._", "module", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "version", "\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "version", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "String_", "(_", "self_", "._", "version", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "sparse_", ",_", "maxt", "ag_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tuple_", "(_", "[_", "sparse_", "._", "get_", "(_", "i_", ",_", "default_", ")_", "for_", "i_", "in_", "xrange_", "(_", "0_", ",_", "1_", "+_", "maxt", "ag_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Sto", "p", "Modul", "e", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "TEXT_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "\"", "Error", "Code", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TYPES_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "0_", ",_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "MAX", "\\u", "TYPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "STYLE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "STYLE", "\\u", "CONTE", "NT", "\\u", "TYPE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PROTO", "\\u", "DESCRIPT", "OR", "\\u", "NAME_", "=_", "'", "app", "hostin", "g", ".", "Sto", "p", "Modul", "e", "Respons", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "contents_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "contents_", "is_", "not_", "None_", ":_", "self_", "._", "Merge", "Fro", "m", "String_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Merge", "From_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "x_", "is_", "not_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Equals_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "is_", "self_", ":_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Is", "Initialized", "_", "(_", "self_", ",_", "debug", "\\u", "strs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "initialized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size", "Parti", "al_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Unc", "heck", "ed_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Parti", "al_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Tr", "y", "Merge_", "(_", "self_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "d_", "._", "avail_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tt_", "=_", "d_", "._", "get", "Var", "Int32_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "tt_", "==_", "0_", ")_", ":_", "raise_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Buffer", "Decode", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "skip", "Data_", "(_", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ",_", "prefix_", "=_", "\"\"_", ",_", "print", "Ele", "m", "Number_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Modul", "e", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "sparse_", ",_", "maxt", "ag_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tuple_", "(_", "[_", "sparse_", "._", "get_", "(_", "i_", ",_", "default_", ")_", "for_", "i_", "in_", "xrange_", "(_", "0_", ",_", "1_", "+_", "maxt", "ag_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Get", "Host", "name", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "\\u", "module", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "version", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "instance", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "km", "odule_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kv", "ersion_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kins", "tanc", "e_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TEXT_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "\"", "Error", "Code", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "\"", "module", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "\"", "version", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "3_", ":_", "\"", "instance", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TYPES_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "3_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "3_", ",_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "MAX", "\\u", "TYPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "STYLE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "STYLE", "\\u", "CONTE", "NT", "\\u", "TYPE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PROTO", "\\u", "DESCRIPT", "OR", "\\u", "NAME_", "=_", "'", "app", "hostin", "g", ".", "Get", "Host", "name", "Request", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "contents_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "contents_", "is_", "not_", "None_", ":_", "self_", "._", "Merge", "Fro", "m", "String_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "module_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "module", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "module_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "module", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "module", "\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "module_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "module", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "module", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "module", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "module_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "module", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "version_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "version", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "version_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "version", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "version", "\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "version_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "version", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "version", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "version", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "version_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "version", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "instance_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "instance", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "instance_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "instance", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "instance", "\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "instance_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "instance", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "instance", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "instance", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "instance_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "instance", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Merge", "From_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "x_", "is_", "not_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "module_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "module_", "(_", "x_", "._", "module_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "version_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "version_", "(_", "x_", "._", "version_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "instance_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "instance_", "(_", "x_", "._", "instance_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Equals_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "is_", "self_", ":_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "module", "\\u_", "!=_", "x_", "._", "has", "\\u", "module", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "module", "\\u_", "and_", "self_", "._", "module", "\\u_", "!=_", "x_", "._", "module", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "version", "\\u_", "!=_", "x_", "._", "has", "\\u", "version", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "version", "\\u_", "and_", "self_", "._", "version", "\\u_", "!=_", "x_", "._", "version", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "instance", "\\u_", "!=_", "x_", "._", "has", "\\u", "instance", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "instance", "\\u_", "and_", "self_", "._", "instance", "\\u_", "!=_", "x_", "._", "instance", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Is", "Initialized", "_", "(_", "self_", ",_", "debug", "\\u", "strs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "initialized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "module", "\\u_", ")_", ":_", "n_", "+=_", "1_", "+_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "module", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "version", "\\u_", ")_", ":_", "n_", "+=_", "1_", "+_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "version", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "instance", "\\u_", ")_", ":_", "n_", "+=_", "1_", "+_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "instance", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size", "Parti", "al_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "module", "\\u_", ")_", ":_", "n_", "+=_", "1_", "+_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "module", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "version", "\\u_", ")_", ":_", "n_", "+=_", "1_", "+_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "version", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "instance", "\\u_", ")_", ":_", "n_", "+=_", "1_", "+_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "instance", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "clear", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear", "\\u", "version_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear", "\\u", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Unc", "heck", "ed_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "has", "\\u", "module", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "module", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "version", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "18_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "version", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "instance", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "26_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "instance", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Parti", "al_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "has", "\\u", "module", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "module", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "version", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "18_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "version", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "instance", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "26_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "instance", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Tr", "y", "Merge_", "(_", "self_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "d_", "._", "avail_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tt_", "=_", "d_", "._", "get", "Var", "Int32_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tt_", "==_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "module_", "(_", "d_", "._", "get", "Prefixe", "d", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tt_", "==_", "18_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "version_", "(_", "d_", "._", "get", "Prefixe", "d", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tt_", "==_", "26_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "instance_", "(_", "d_", "._", "get", "Prefixe", "d", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "tt_", "==_", "0_", ")_", ":_", "raise_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Buffer", "Decode", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "skip", "Data_", "(_", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ",_", "prefix_", "=_", "\"\"_", ",_", "print", "Ele", "m", "Number_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "module", "\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "module", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "String_", "(_", "self_", "._", "module", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "version", "\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "version", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "String_", "(_", "self_", "._", "version", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "instance", "\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "instance", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "String_", "(_", "self_", "._", "instance", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "sparse_", ",_", "maxt", "ag_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tuple_", "(_", "[_", "sparse_", "._", "get_", "(_", "i_", ",_", "default_", ")_", "for_", "i_", "in_", "xrange_", "(_", "0_", ",_", "1_", "+_", "maxt", "ag_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Get", "Host", "name", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "\\u", "host", "name\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host", "name\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kh", "ost", "name_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TEXT_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "\"", "Error", "Code", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "\"", "host", "name", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TYPES_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "1_", ",_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "MAX", "\\u", "TYPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "STYLE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "STYLE", "\\u", "CONTE", "NT", "\\u", "TYPE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PROTO", "\\u", "DESCRIPT", "OR", "\\u", "NAME_", "=_", "'", "app", "hostin", "g", ".", "Get", "Host", "name", "Respons", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "contents_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "contents_", "is_", "not_", "None_", ":_", "self_", "._", "Merge", "Fro", "m", "String_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "hostname_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "host", "name\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "hostname_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "host", "name\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "host", "name\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "hostname_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "host", "name\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "host", "name\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "host", "name\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "hostname_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "host", "name\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Merge", "From_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "x_", "is_", "not_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "hostname_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "hostname_", "(_", "x_", "._", "hostname_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Equals_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "is_", "self_", ":_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "host", "name\\u_", "!=_", "x_", "._", "has", "\\u", "host", "name\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "host", "name\\u_", "and_", "self_", "._", "host", "name\\u_", "!=_", "x_", "._", "host", "name\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Is", "Initialized", "_", "(_", "self_", ",_", "debug", "\\u", "strs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "self_", "._", "has", "\\u", "host", "name\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "debug", "\\u", "strs_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "debug", "\\u", "strs_", "._", "append_", "(_", "'", "Requ", "ired", " ", "field", ":", " ", "host", "name", " ", "not", " ", "set", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "initialized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "+=_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "host", "name\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size", "Parti", "al_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "host", "name\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "+=_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "host", "name\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "clear", "\\u", "hostname_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Unc", "heck", "ed_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "host", "name\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Parti", "al_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "has", "\\u", "host", "name\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "host", "name\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Tr", "y", "Merge_", "(_", "self_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "d_", "._", "avail_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tt_", "=_", "d_", "._", "get", "Var", "Int32_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tt_", "==_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "hostname_", "(_", "d_", "._", "get", "Prefixe", "d", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "tt_", "==_", "0_", ")_", ":_", "raise_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Buffer", "Decode", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "skip", "Data_", "(_", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ",_", "prefix_", "=_", "\"\"_", ",_", "print", "Ele", "m", "Number_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "host", "name\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "host", "name", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "String_", "(_", "self_", "._", "host", "name\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Host", "name", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "sparse_", ",_", "maxt", "ag_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tuple_", "(_", "[_", "sparse_", "._", "get_", "(_", "i_", ",_", "default_", ")_", "for_", "i_", "in_", "xrange_", "(_", "0_", ",_", "1_", "+_", "maxt", "ag_", ")_", "]_", ")_", "\\u\\u\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
First parameter of a method is not named 'self'
allisson/flask-example/accounts/forms.py
[ { "content": " def validate_username(form, field):\n username = field.data\n try:\n form.user = User.objects.get(username=username)\n except:\n raise ValidationError(u'Login not found.')", "metadata": "root.LoginForm.validate_username", "header": "['class', 'LoginForm', '(', 'Form', ')', ':', '___EOS___']", "index": 31 }, { "content": " def validate_password(form, field):\n password = field.data\n if form.user:\n if not form.user.check_password(password):\n raise ValidationError(u'Incorrect password.')", "metadata": "root.LoginForm.validate_password", "header": "['class', 'LoginForm', '(', 'Form', ')', ':', '___EOS___']", "index": 38 }, { "content": " def validate_email(form, field):\n email = field.data\n if User.objects.filter(email=email):\n raise ValidationError(u'E-mail in use.')", "metadata": "root.SignupForm.validate_email", "header": "['class', 'SignupForm', '(', 'Form', ')', ':', '___EOS___']", "index": 56 }, { "content": " def validate_username(form, field):\n username = field.data\n if User.objects.filter(username=username):\n raise ValidationError(u'Login in use.')", "metadata": "root.SignupConfirmForm.validate_username", "header": "['class', 'SignupConfirmForm', '(', 'Form', ')', ':', '___EOS___']", "index": 137 }, { "content": " def validate_password_confirm(form, field):\n password = form.password.data\n password_confirm = field.data\n if password != password_confirm:\n raise ValidationError(u'Incorrect password.')", "metadata": "root.SignupConfirmForm.validate_password_confirm", "header": "['class', 'SignupConfirmForm', '(', 'Form', ')', ':', '___EOS___']", "index": 142 }, { "content": " def validate_email(form, field):\n email = field.data\n if not User.objects.filter(email=email):\n raise ValidationError(u'E-mail not found.')", "metadata": "root.RecoverPasswordForm.validate_email", "header": "['class', 'RecoverPasswordForm', '(', 'Form', ')', ':', '___EOS___']", "index": 170 }, { "content": " def validate_password_confirm(form, field):\n password = form.password.data\n password_confirm = field.data\n if password != password_confirm:\n raise ValidationError(u'Incorrect password.')", "metadata": "root.RecoverPasswordConfirmForm.validate_password_confirm", "header": "['class', 'RecoverPasswordConfirmForm', '(', 'Form', ')', ':', '___EOS___']", "index": 229 } ]
[ { "span": "def validate_username(form, field):", "start_line": 31, "start_column": 4, "end_line": 31, "end_column": 39 }, { "span": "def validate_password(form, field):", "start_line": 38, "start_column": 4, "end_line": 38, "end_column": 39 }, { "span": "def validate_email(form, field):", "start_line": 56, "start_column": 4, "end_line": 56, "end_column": 36 }, { "span": "def validate_username(form, field):", "start_line": 137, "start_column": 4, "end_line": 137, "end_column": 39 }, { "span": "def validate_password_confirm(form, field):", "start_line": 142, "start_column": 4, "end_line": 142, "end_column": 47 }, { "span": "def validate_email(form, field):", "start_line": 170, "start_column": 4, "end_line": 170, "end_column": 36 }, { "span": "def validate_password_confirm(form, field):", "start_line": 229, "start_column": 4, "end_line": 229, "end_column": 47 } ]
[]
1
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Logi", "n", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "validat", "e\\u", "username_", "(_", "form_", ",_", "field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", "=_", "field_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "._", "user_", "=_", "User_", "._", "objects_", "._", "get_", "(_", "username_", "=_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "u", "'", "Logi", "n", " ", "not", " ", "found", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Logi", "n", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validat", "e\\u", "password_", "(_", "form_", ",_", "field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "password_", "=_", "field_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form_", "._", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "form_", "._", "user_", "._", "check", "\\u", "password_", "(_", "password_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "u", "'", "Inco", "rrect", " ", "password", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sign", "up", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "validat", "e\\u", "email_", "(_", "form_", ",_", "field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "email_", "=_", "field_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "User_", "._", "objects_", "._", "filter_", "(_", "email_", "=_", "email_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "u", "'", "E-", "mail", " ", "in", " ", "use", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sign", "up", "Confirm", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "validat", "e\\u", "username_", "(_", "form_", ",_", "field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", "=_", "field_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "User_", "._", "objects_", "._", "filter_", "(_", "username_", "=_", "username_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "u", "'", "Logi", "n", " ", "in", " ", "use", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sign", "up", "Confirm", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validat", "e\\u", "password", "\\u", "confirm_", "(_", "form_", ",_", "field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "password_", "=_", "form_", "._", "password_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password", "\\u", "confirm_", "=_", "field_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "password_", "!=_", "password", "\\u", "confirm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "u", "'", "Inco", "rrect", " ", "password", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Recover", "Passw", "ord", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "validat", "e\\u", "email_", "(_", "form_", ",_", "field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "email_", "=_", "field_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "User_", "._", "objects_", "._", "filter_", "(_", "email_", "=_", "email_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "u", "'", "E-", "mail", " ", "not", " ", "found", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Recover", "Passw", "ord", "Confirm", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "validat", "e\\u", "password", "\\u", "confirm_", "(_", "form_", ",_", "field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "password_", "=_", "form_", "._", "password_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password", "\\u", "confirm_", "=_", "field_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "password_", "!=_", "password", "\\u", "confirm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "u", "'", "Inco", "rrect", " ", "password", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
PythonProgramming/Beginning-Game-Development-with-Python-and-Pygame/Chapter 12/fogdemo.py
[ { "content": "def run():\n\n pygame.init()\n screen = pygame.display.set_mode(SCREEN_SIZE, HWSURFACE|OPENGL|DOUBLEBUF)\n\n resize(*SCREEN_SIZE)\n init()\n\n clock = pygame.time.Clock()\n\n # Read the model\n tank_model = model3d.Model3D()\n tank_model.read_obj('mytank.obj')\n\n rotation = 0.0\n\n while True:\n\n for event in pygame.event.get():\n if event.type == QUIT:\n pygame.quit()\n quit()\n\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)\n\n time_passed = clock.tick()\n time_passed_seconds = time_passed / 1000.0\n \n \n\n glLoadIdentity()\n glRotatef(15, 1, 0, 0)\n \n tank_distance = pygame.mouse.get_pos()[1] / 50.0\n glTranslatef(0.0, -1.5, -tank_distance)\n \n #glTranslatef(0.0, -1.5, -3.5)\n\n rotation += time_passed_seconds * 45.0\n glRotatef(rotation, 0, 1, 0)\n\n tank_model.draw_quick()\n\n pygame.display.flip()", "metadata": "root.run", "header": "['module', '___EOS___']", "index": 65 } ]
[ { "span": "screen ", "start_line": 68, "start_column": 4, "end_line": 68, "end_column": 10 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pygame_", "._", "init_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "screen_", "=_", "pygame_", "._", "display_", "._", "set\\u", "mode_", "(_", "SCREEN", "\\u", "SIZE_", ",_", "HW", "SURF", "ACE", "_", "|_", "OPEN", "GL_", "|_", "DOUBLE", "BUF", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resize_", "(_", "*_", "SCREEN", "\\u", "SIZE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "clock_", "=_", "pygame_", "._", "time_", "._", "Clock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Read", " ", "the", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "tank", "\\u", "model_", "=_", "model", "3d_", "._", "Model", "3", "D_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tank", "\\u", "model_", "._", "read", "\\u", "obj_", "(_", "'", "myt", "ank", ".", "obj", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rotation_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "event_", "in_", "pygame_", "._", "event_", "._", "get_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "event_", "._", "type_", "==_", "QUIT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pygame_", "._", "quit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "quit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gl", "Clear_", "(_", "GL", "\\u", "COLOR", "\\u", "BUFF", "ER", "\\u", "BIT_", "|_", "GL", "\\u", "DEPTH", "\\u", "BUFF", "ER", "\\u", "BIT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "time", "\\u", "passed_", "=_", "clock_", "._", "tick_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time", "\\u", "pass", "ed", "\\u", "seconds_", "=_", "time", "\\u", "passed_", "/_", "1000.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gl", "Load", "Identity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Rotate", "f_", "(_", "15_", ",_", "1_", ",_", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tank", "\\u", "distance_", "=_", "pygame_", "._", "mouse_", "._", "get", "\\u", "pos_", "(_", ")_", "[_", "1_", "]_", "/_", "50.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Translate", "f_", "(_", "0.0_", ",_", "-_", "1.5_", ",_", "-_", "tank", "\\u", "distance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "gl", "Translate", "f", "(", "0.", "0", ",", " ", "-1", ".5", ",", " ", "-", "3.5", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rotation_", "+=_", "time", "\\u", "pass", "ed", "\\u", "seconds_", "*_", "45.", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Rotate", "f_", "(_", "rotation_", ",_", "0_", ",_", "1_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tank", "\\u", "model_", "._", "draw", "\\u", "quick", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pygame_", "._", "display_", "._", "flip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
karlnapf/kameleon-mcmc/kameleon_mcmc/experiments/scripts/banana_8/banana_8_big_local_GMMMetropolis.py
[ { "content": "\"\"\"\nThis program is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 3 of the License, or\n(at your option) any later version.\n\nWritten (W) 2013-2014 Heiko Strathmann\nWritten (W) 2013 Dino Sejdinovic\n\"\"\"\n\nfrom numpy.lib.twodim_base import eye\nfrom numpy.ma.core import zeros\nimport os\nimport sys\n\nfrom kameleon_mcmc.distribution.Banana import Banana\nfrom kameleon_mcmc.experiments.SingleChainExperiment import SingleChainExperiment\nfrom kameleon_mcmc.kernel.GaussianKernel import GaussianKernel\nfrom kameleon_mcmc.mcmc.MCMCChain import MCMCChain\nfrom kameleon_mcmc.mcmc.MCMCParams import MCMCParams\nfrom kameleon_mcmc.mcmc.output.StatisticsOutput import StatisticsOutput\nfrom kameleon_mcmc.mcmc.samplers.GMMMetropolis import GMMMetropolis\nfrom kameleon_mcmc.mcmc.samplers.StandardMetropolis import StandardMetropolis\n\n\nif __name__ == '__main__':\n experiment_dir = str(os.path.abspath(sys.argv[0])).split(os.sep)[-1].split(\".\")[0] + os.sep\n \n distribution = Banana(dimension=8, bananicity=0.1, V=100)\n \n \n \n burnin = 40000\n num_iterations = 80000\n \n mcmc_sampler = GMMMetropolis(distribution, num_components=10, num_sample_discard=500,\n num_samples_gmm=1000, num_samples_when_to_switch=10000, num_runs_em=10)\n #mean_est = zeros(distribution.dimension, dtype=\"float64\")\n #cov_est = 1.0 * eye(distribution.dimension)\n #cov_est[0, 0] = distribution.V\n #mcmc_sampler = AdaptiveMetropolisLearnScale(distribution, mean_est=mean_est, cov_est=cov_est)\n #mcmc_sampler = AdaptiveMetropolis(distribution, mean_est=mean_est, cov_est=cov_est)\n #mcmc_sampler = StandardMetropolis(distribution)\n \n start = zeros(distribution.dimension, dtype=\"float64\")\n mcmc_params = MCMCParams(start=start, num_iterations=num_iterations, burnin=burnin)\n \n mcmc_chain = MCMCChain(mcmc_sampler, mcmc_params)\n mcmc_chain.append_mcmc_output(StatisticsOutput())\n \n experiment = SingleChainExperiment(mcmc_chain, experiment_dir)\n experiment.run()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from numpy.lib.twodim_base import eye", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 37 }, { "span": "from kameleon_mcmc.kernel.GaussianKernel import GaussianKernel", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 62 }, { "span": "from kameleon_mcmc.mcmc.samplers.StandardMetropolis import StandardMetropolis", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 77 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Thi", "s", " ", "program", " ", "is", " ", "free", " ", "software", ";", " ", "you", " ", "can", " ", "redis", "tribut", "e", " ", "it", " ", "and", "/", "or", " ", "modif", "y", "\\", "10", ";", "it", " ", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", " ", "as", " ", "publi", "shed", " ", "by", "\\", "10", ";", "the", " ", "Free", " ", "Sof", "twa", "re", " ", "Foun", "dati", "on", ";", " ", "eit", "her", " ", "version", " ", "3", " ", "of", " ", "the", " ", "License", ",", " ", "or", "\\", "10", ";", "(", "at", " ", "your", " ", "option", ")", " ", "any", " ", "late", "r", " ", "version", ".", "\\", "10", ";", "\\", "10", ";", "Writ", "ten", " ", "(", "W", ")", " ", "2013", "-", "2014", " ", "Hei", "ko", " ", "Strat", "hma", "nn", "\\", "10", ";", "Writ", "ten", " ", "(", "W", ")", " ", "2013", " ", "Din", "o", " ", "Se", "jd", "ino", "vic", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "numpy_", "._", "lib_", "._", "two", "dim", "\\u", "base_", "import_", "eye_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "._", "ma_", "._", "core_", "import_", "zeros_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kam", "ele", "on", "\\u", "mcmc", "_", "._", "distribution_", "._", "Ban", "ana", "_", "import_", "Ban", "ana", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kam", "ele", "on", "\\u", "mcmc", "_", "._", "experiments_", "._", "Sing", "le", "Chain", "Experiment_", "import_", "Sing", "le", "Chain", "Experiment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kam", "ele", "on", "\\u", "mcmc", "_", "._", "kernel_", "._", "Gaussian", "Kernel_", "import_", "Gaussian", "Kernel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kam", "ele", "on", "\\u", "mcmc", "_", "._", "mcmc", "_", "._", "MCM", "CC", "hain", "_", "import_", "MCM", "CC", "hain", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kam", "ele", "on", "\\u", "mcmc", "_", "._", "mcmc", "_", "._", "MCM", "CP", "arams_", "import_", "MCM", "CP", "arams_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kam", "ele", "on", "\\u", "mcmc", "_", "._", "mcmc", "_", "._", "output_", "._", "Statistic", "s", "Output_", "import_", "Statistic", "s", "Output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kam", "ele", "on", "\\u", "mcmc", "_", "._", "mcmc", "_", "._", "sampler", "s_", "._", "GM", "MM", "etr", "opo", "lis_", "import_", "GM", "MM", "etr", "opo", "lis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kam", "ele", "on", "\\u", "mcmc", "_", "._", "mcmc", "_", "._", "sampler", "s_", "._", "Standard", "Metro", "polis", "_", "import_", "Standard", "Metro", "polis", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "experiment", "\\u", "dir_", "=_", "str_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "sys_", "._", "argv_", "[_", "0_", "]_", ")_", ")_", "._", "split_", "(_", "os_", "._", "sep_", ")_", "[_", "-_", "1_", "]_", "._", "split_", "(_", "\".\"_", ")_", "[_", "0_", "]_", "+_", "os_", "._", "sep_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "distribution_", "=_", "Ban", "ana", "_", "(_", "dimension_", "=_", "8_", ",_", "ban", "ani", "city_", "=_", "0.1_", ",_", "V_", "=_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "burn", "in_", "=_", "40000", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "iterations_", "=_", "80000", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mcmc", "\\u", "sampler_", "=_", "GM", "MM", "etr", "opo", "lis_", "(_", "distribution_", ",_", "num", "\\u", "components_", "=_", "10_", ",_", "num", "\\u", "sample", "\\u", "discard_", "=_", "500_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "samples", "\\u", "gmm", "_", "=_", "1000_", ",_", "num", "\\u", "samples", "\\u", "whe", "n", "\\u", "to", "\\u", "switch_", "=_", "10000_", ",_", "num", "\\u", "runs", "\\u", "em_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "mean", "\\u", "est", " ", "=", " ", "zero", "s", "(", "distribu", "tion", ".", "dimension", ",", " ", "dt", "ype", "=\"", "float", "64", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cov", "\\u", "est", " ", "=", " ", "1.0", " ", "*", " ", "eye", "(", "distribu", "tion", ".", "dimension", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cov", "\\u", "est", "[", "0", ",", " ", "0", "]", " ", "=", " ", "distribu", "tion", ".", "V_", "\\u\\u\\uNL\\u\\u\\u_", "#", "mcmc", "\\u", "sampler", " ", "=", " ", "Adapti", "ve", "Metro", "polis", "Learn", "Scale", "(", "distribu", "tion", ",", " ", "mean", "\\u", "est", "=", "mean", "\\u", "est", ",", " ", "cov", "\\u", "est", "=", "cov", "\\u", "est", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "mcmc", "\\u", "sampler", " ", "=", " ", "Adapti", "ve", "Metro", "polis", "(", "distribu", "tion", ",", " ", "mean", "\\u", "est", "=", "mean", "\\u", "est", ",", " ", "cov", "\\u", "est", "=", "cov", "\\u", "est", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "mcmc", "\\u", "sampler", " ", "=", " ", "Standard", "Metro", "polis", "(", "distribu", "tion", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start_", "=_", "zeros_", "(_", "distribution_", "._", "dimension_", ",_", "dtype_", "=_", "\"", "float", "64", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mcmc", "\\u", "params_", "=_", "MCM", "CP", "arams_", "(_", "start_", "=_", "start_", ",_", "num", "\\u", "iterations_", "=_", "num", "\\u", "iterations_", ",_", "burn", "in_", "=_", "burn", "in_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mcmc", "\\u", "chain_", "=_", "MCM", "CC", "hain", "_", "(_", "mcmc", "\\u", "sampler_", ",_", "mcmc", "\\u", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mcmc", "\\u", "chain_", "._", "append", "\\u", "mcmc", "\\u", "output_", "(_", "Statistic", "s", "Output_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "experiment_", "=_", "Sing", "le", "Chain", "Experiment_", "(_", "mcmc", "\\u", "chain_", ",_", "experiment", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "experiment_", "._", "run_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Comparison using is when operands support `__eq__`
anzev/hedwig/build/pip/pip/compat/dictconfig.py
[ { "content": " def __getitem__(self, key):\n value = list.__getitem__(self, key)\n result = self.configurator.convert(value)\n # If the converted value is different, save for next time\n if value is not result:\n self[key] = result\n if type(result) in (ConvertingDict, ConvertingList,\n ConvertingTuple):\n result.parent = self\n result.key = key\n return result", "metadata": "root.ConvertingList.__getitem__", "header": "['class', 'ConvertingList', '(', 'list', ')', ':', '___EOS___']", "index": 107 } ]
[ { "span": "value is not result:", "start_line": 111, "start_column": 11, "end_line": 111, "end_column": 30 } ]
[]
1
false
[ "[CLS]_", "Compari", "son_", "using_", "is_", "when_", "operands_", "support_", " _", "`_", "\\u\\u", "eq\\u\\u_", "`_", "[SEP]_", "class_", "Converti", "ng", "List_", "(_", "list_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "list_", "._", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "configurator", "_", "._", "convert_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "convert", "ed", " ", "value", " ", "is", " ", "different", ",", " ", "save", " ", "for", " ", "next", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "value_", "is_", "not_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "[_", "key_", "]_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "result_", ")_", "in_", "(_", "Converti", "ng", "Dict_", ",_", "Converti", "ng", "List_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Converti", "ng", "Tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "parent_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "key_", "=_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
yajiemiao/pdnn/io_func/data_io.py
[ { "content": "# Copyright 2013 Yajie Miao Carnegie Mellon University\n# 2015 Yun Wang Carnegie Mellon University\n\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\n# WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\n# MERCHANTABLITY OR NON-INFRINGEMENT.\n# See the Apache 2 License for the specific language governing permissions and\n# limitations under the License.\n\nimport gzip\nimport os\nimport sys, re\nimport glob\n\nimport numpy\nimport theano\nimport theano.tensor as T\nfrom utils.utils import string2bool, parse_ignore_label, parse_map_label\nfrom pfile_io import PfileDataRead, PfileDataReadStream\nfrom pickle_io import PickleDataRead\nfrom kaldi_io import KaldiDataRead\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def read_data_args(data_spec):\n elements = data_spec.split(\",\")\n pfile_path_list = glob.glob(elements[0])\n dataset_args = {}\n # default settings\n dataset_args['type'] = 'pickle'\n dataset_args['random'] = False\n dataset_args['stream'] = False\n dataset_args['partition'] = 1024 * 1024 * 600 # by default the partition size is 600m if stream is True\n dataset_args['lcxt'] = 0\n dataset_args['rcxt'] = 0\n\n # the type of the data: pickle, pfile TO-DO: HDF5\n if '.pickle' in data_spec or '.pkl' in data_spec:\n dataset_args['type'] = 'pickle'\n elif '.pfile' in data_spec:\n dataset_args['type'] = 'pfile'\n elif '.scp' in data_spec:\n dataset_args['type'] = 'kaldi'\n else:\n dataset_args['type'] = ''\n\n for i in range(1, len(elements)):\n element = elements[i]\n arg_value = element.split(\"=\")\n value = arg_value[1]\n key = arg_value[0]\n if key == 'partition':\n dataset_args['partition'] = 1024 * 1024 * int(value.replace('m',''))\n elif key == 'stream':\n dataset_args['stream'] = string2bool(value) # not supported for now\n elif key == 'random':\n dataset_args['random'] = string2bool(value)\n elif key == 'label':\n dataset_args['label'] = value\n elif key == 'lcxt':\n dataset_args['lcxt'] = int(value)\n elif key == 'rcxt':\n dataset_args['rcxt'] = int(value)\n elif key == 'context':\n value = tuple(int(x) for x in value.split(':'))\n if len(value) == 1: value += value\n dataset_args['lcxt'], dataset_args['rcxt'] = value\n elif key == 'ignore-label':\n dataset_args['ignore-label'] = parse_ignore_label(value)\n elif key == 'map-label':\n dataset_args['map-label'] = parse_map_label(value)\n else:\n dataset_args[key] = value\n return pfile_path_list, dataset_args", "metadata": "root.read_data_args", "header": "['module', '___EOS___']", "index": 29 }, { "content": "def read_dataset(file_path_list, read_opts):\n if read_opts['type'] == 'pickle':\n data_reader = PickleDataRead(file_path_list, read_opts)\n elif read_opts['type'] == 'pfile':\n if read_opts['stream']:\n data_reader = PfileDataReadStream(file_path_list, read_opts)\n else:\n data_reader = PfileDataRead(file_path_list, read_opts)\n elif read_opts['type'] == 'kaldi':\n data_reader = KaldiDataRead(file_path_list, read_opts)\n\n data_reader.initialize_read(first_time_reading = True)\n\n shared_xy = data_reader.make_shared()\n shared_x, shared_y = shared_xy\n shared_y = T.cast(shared_y, 'int32')\n\n return data_reader, shared_xy, shared_x, shared_y", "metadata": "root.read_dataset", "header": "['module', '___EOS___']", "index": 80 } ]
[ { "span": "import gzip", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 11 }, { "span": "import os", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 9 }, { "span": "import sys, re", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 14 }, { "span": "import numpy", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 12 }, { "span": "import theano", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2013", " ", " ", " ", " ", "Ya", "jie", " ", "Mi", "ao", " ", " ", " ", " ", "Car", "neg", "ie", " ", "Mel", "lon", " ", "Univers", "ity_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "201", "5", " ", " ", " ", " ", "Yu", "n", " ", "Wan", "g", " ", " ", "Car", "neg", "ie", " ", "Mel", "lon", " ", "Univers", "ity_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THIS", " ", "CODE", " ", "IS", " ", "PROVI", "DED", " ", "*", "AS", " ", "IS", "*", " ", "BAS", "IS", ",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "KIND", ",", " ", "EI", "THER", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "WITH", "OUT", " ", "LIMIT", "ATION", " ", "ANY", " ", "IMPL", "IED", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "TIT", "LE", ",", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "MER", "CHAN", "TAB", "LIT", "Y", " ", "OR", " ", "NON", "-", "INF", "RING", "EME", "NT", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "Ap", "ache", " ", "2", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "gzip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", ",_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "theano_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "theano_", "._", "tensor_", "as_", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "utils_", "._", "utils_", "import_", "string", "2b", "ool_", ",_", "parse", "\\u", "ignore", "\\u", "label_", ",_", "parse", "\\u", "map", "\\u", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pfile", "\\u", "io_", "import_", "Pf", "ile", "Data", "Read_", ",_", "Pf", "ile", "Data", "Read", "Stream_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pickle", "\\u", "io_", "import_", "Pickl", "e", "Data", "Read_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kal", "di", "\\u", "io_", "import_", "Kal", "di", "Data", "Read_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "read", "\\u", "data\\u", "args_", "(_", "data\\u", "spec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "elements_", "=_", "data\\u", "spec_", "._", "split_", "(_", "\",\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pfile", "\\u", "path", "\\u", "list_", "=_", "glob_", "._", "glob_", "(_", "elements_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dataset", "\\u", "args_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "default", " ", "settings_", "\\u\\u\\uNL\\u\\u\\u_", "dataset", "\\u", "args_", "[_", "'", "type", "'_", "]_", "=_", "'", "pickle", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dataset", "\\u", "args_", "[_", "'", "random", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dataset", "\\u", "args_", "[_", "'", "stream", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dataset", "\\u", "args_", "[_", "'", "partit", "ion", "'_", "]_", "=_", "1024_", "*_", "1024_", "*_", "600_", "#", " ", "by", " ", "default", " ", "the", " ", "partit", "ion", " ", "size", " ", "is", " ", "600", "m", " ", "if", " ", "stream", " ", "is", " ", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dataset", "\\u", "args_", "[_", "'", "lc", "xt", "'_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dataset", "\\u", "args_", "[_", "'", "rc", "xt", "'_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "type", " ", "of", " ", "the", " ", "data", ":", " ", "pickle", ",", " ", "pfile", " ", " ", " ", "TO", "-", "DO", ":", " ", "HDF", "5_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'.", "pickle", "'_", "in_", "data\\u", "spec_", "or_", "'.", "pkl", "'_", "in_", "data\\u", "spec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataset", "\\u", "args_", "[_", "'", "type", "'_", "]_", "=_", "'", "pickle", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'.", "pfile", "'_", "in_", "data\\u", "spec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataset", "\\u", "args_", "[_", "'", "type", "'_", "]_", "=_", "'", "pfile", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'.", "scp", "'_", "in_", "data\\u", "spec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataset", "\\u", "args_", "[_", "'", "type", "'_", "]_", "=_", "'", "kal", "di", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataset", "\\u", "args_", "[_", "'", "type", "'_", "]_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "1_", ",_", "len_", "(_", "elements_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "element_", "=_", "elements_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arg", "\\u", "value_", "=_", "element_", "._", "split_", "(_", "\"=\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "arg", "\\u", "value_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "arg", "\\u", "value_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "==_", "'", "partit", "ion", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataset", "\\u", "args_", "[_", "'", "partit", "ion", "'_", "]_", "=_", "1024_", "*_", "1024_", "*_", "int_", "(_", "value_", "._", "replace_", "(_", "'", "m", "'_", ",_", "''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'", "stream", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataset", "\\u", "args_", "[_", "'", "stream", "'_", "]_", "=_", "string", "2b", "ool_", "(_", "value_", ")_", "#", " ", "not", " ", "support", "ed", " ", "for", " ", "now_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'", "random", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataset", "\\u", "args_", "[_", "'", "random", "'_", "]_", "=_", "string", "2b", "ool_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'", "label", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataset", "\\u", "args_", "[_", "'", "label", "'_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'", "lc", "xt", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataset", "\\u", "args_", "[_", "'", "lc", "xt", "'_", "]_", "=_", "int_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'", "rc", "xt", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataset", "\\u", "args_", "[_", "'", "rc", "xt", "'_", "]_", "=_", "int_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'", "context", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "tuple_", "(_", "int_", "(_", "x_", ")_", "for_", "x_", "in_", "value_", "._", "split_", "(_", "':'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "value_", ")_", "==_", "1_", ":_", "value_", "+=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dataset", "\\u", "args_", "[_", "'", "lc", "xt", "'_", "]_", ",_", "dataset", "\\u", "args_", "[_", "'", "rc", "xt", "'_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'", "ignore", "-", "label", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataset", "\\u", "args_", "[_", "'", "ignore", "-", "label", "'_", "]_", "=_", "parse", "\\u", "ignore", "\\u", "label_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'", "map", "-", "label", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataset", "\\u", "args_", "[_", "'", "map", "-", "label", "'_", "]_", "=_", "parse", "\\u", "map", "\\u", "label_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataset", "\\u", "args_", "[_", "key_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "pfile", "\\u", "path", "\\u", "list_", ",_", "dataset", "\\u", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "dataset_", "(_", "file", "\\u", "path", "\\u", "list_", ",_", "read", "\\u", "opts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "read", "\\u", "opts_", "[_", "'", "type", "'_", "]_", "==_", "'", "pickle", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "reader_", "=_", "Pickl", "e", "Data", "Read_", "(_", "file", "\\u", "path", "\\u", "list_", ",_", "read", "\\u", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "read", "\\u", "opts_", "[_", "'", "type", "'_", "]_", "==_", "'", "pfile", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "read", "\\u", "opts_", "[_", "'", "stream", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "reader_", "=_", "Pf", "ile", "Data", "Read", "Stream_", "(_", "file", "\\u", "path", "\\u", "list_", ",_", "read", "\\u", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "reader_", "=_", "Pf", "ile", "Data", "Read_", "(_", "file", "\\u", "path", "\\u", "list_", ",_", "read", "\\u", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "read", "\\u", "opts_", "[_", "'", "type", "'_", "]_", "==_", "'", "kal", "di", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "reader_", "=_", "Kal", "di", "Data", "Read_", "(_", "file", "\\u", "path", "\\u", "list_", ",_", "read", "\\u", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data\\u", "reader_", "._", "initialize", "\\u", "read_", "(_", "first", "\\u", "time", "\\u", "reading_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "shared", "\\u", "xy_", "=_", "data\\u", "reader_", "._", "make", "\\u", "shared_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shared", "\\u", "x_", ",_", "shared", "\\u", "y_", "=_", "shared", "\\u", "xy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shared", "\\u", "y_", "=_", "T_", "._", "cast_", "(_", "shared", "\\u", "y_", ",_", "'", "int", "32", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "data\\u", "reader_", ",_", "shared", "\\u", "xy_", ",_", "shared", "\\u", "x_", ",_", "shared", "\\u", "y_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Module is imported with 'import' and 'import from'
django-webtest/django-webtest/django_webtest/compat.py
[ { "content": "import sys\nimport urllib\n\nPY3 = sys.version_info[0] == 3\n\nif PY3:\n from urllib import parse as urlparse\n\n\n\n\nelse:\n import urlparse\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import urllib", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PY", "3_", "=_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "urllib_", "import_", "parse_", "as_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
DummyDivision/Tsune/upload/views.py
[ { "content": "from django.core.urlresolvers import reverse\nfrom django.http import HttpResponseRedirect\nfrom django.shortcuts import render_to_response\nfrom django.template import RequestContext\nimport os\nimport tempfile\nimport uuid\nimport shutil\nfrom forms import UploadFileForm\nfrom cardimporter.importer import AnkiImporter\nfrom os import path,removedirs\nfrom tsune.settings.base import PROJECT_DIR\n\nTEMP_DIR = PROJECT_DIR + \"/temp\"\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def upload_file(request):\n if request.method == 'POST':\n form = UploadFileForm(request.POST, request.FILES)\n if form.is_valid():\n handle_uploaded_file(request.FILES['file'],request.user)\n return HttpResponseRedirect(reverse(\"deck:deck_list\") )\n else:\n form = UploadFileForm()\n return render_to_response('upload.html', RequestContext(request,{'form': form}))", "metadata": "root.upload_file", "header": "['module', '___EOS___']", "index": 15 }, { "content": "def handle_uploaded_file(f, user):\n # TODO Check if file is actually Anki File beforehand\n temp_path = tempfile.mkdtemp()\n file_path = temp_path + \"/\" + f.name\n with open(file_path, 'w') as destination:\n for chunk in f.chunks():\n destination.write(chunk)\n anki = AnkiImporter()\n try:\n anki.importCollection(file_path,user)\n finally:\n shutil.rmtree(temp_path, ignore_errors=True)", "metadata": "root.handle_uploaded_file", "header": "['module', '___EOS___']", "index": 27 } ]
[ { "span": "import os", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 9 }, { "span": "import uuid", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 11 }, { "span": "from os import path,removedirs", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 30 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Respons", "e", "Redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "shortcuts_", "import_", "render", "\\u", "to", "\\u", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Request", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "forms_", "import_", "Upload", "File", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cardi", "mpor", "ter_", "._", "importer_", "import_", "An", "ki", "Importer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "import_", "path_", ",_", "remove", "dirs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tsu", "ne_", "._", "settings_", "._", "base_", "import_", "PROJECT", "\\u", "DIR_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TEMP", "\\u", "DIR_", "=_", "PROJECT", "\\u", "DIR_", "+_", "\"/", "temp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "upload", "\\u", "file_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "Upload", "File", "Form_", "(_", "request_", "._", "POST_", ",_", "request_", "._", "FILES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handle", "\\u", "uploade", "d\\u", "file_", "(_", "request_", "._", "FILES_", "[_", "'", "file", "'_", "]_", ",_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "reverse_", "(_", "\"", "deck", ":", "deck", "\\u", "list", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "Upload", "File", "Form_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "upload", ".", "html", "'_", ",_", "Request", "Context_", "(_", "request_", ",_", "{_", "'", "form", "'_", ":_", "form_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handle", "\\u", "uploade", "d\\u", "file_", "(_", "f_", ",_", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "Check", " ", "if", " ", "file", " ", "is", " ", "actual", "ly", " ", "An", "ki", " ", "File", " ", "bef", "ore", "hand_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp", "\\u", "path_", "=_", "tempfile_", "._", "mkdtemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "path_", "=_", "temp", "\\u", "path_", "+_", "\"/\"_", "+_", "f_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "file", "\\u", "path_", ",_", "'", "w", "'_", ")_", "as_", "destination_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "chunk_", "in_", "f_", "._", "chunks_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "destination_", "._", "write_", "(_", "chunk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ank", "i_", "=_", "An", "ki", "Importer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ank", "i_", "._", "import", "Collection_", "(_", "file", "\\u", "path_", ",_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "rmtree_", "(_", "temp", "\\u", "path_", ",_", "ignore", "\\u", "errors_", "=_", "True_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
ifduyue/urlfetch/tests/server.py
[ { "content": "def mb_code(s, encoding='utf-8'):\n for c in ('utf-8', 'gb2312', 'gbk', 'gb18030', 'big5'):\n try:\n return s.decode(c).encode(encoding)\n except: pass\n try:\n return s.encode(encoding)\n except: raise", "metadata": "root.mb_code", "header": "['module', '___EOS___']", "index": 9 }, { "content": "@app.route('/links/<n>')\ndef links(n):\n try:\n n = int(n)\n except:\n n = None\n if n == 1:\n response.set_header('Link', '</links/2>; rel=\"next\", </links/3>; rel=\"last\"')\n elif n == 2:\n response.set_header('Link', '</links/3>; rel=\"next\", </links/3>; rel=\"last\", </links/1>; rel=\"prev\", </links/1>; rel=\"first\"')\n elif n == 3:\n response.set_header('Link', '</links/1>; rel=\"prev\", </links/1>; rel=\"first\"')\n elif n is None:\n response.set_header('Link', '</links/none>; rel=\"self\"')\n else:\n response.set_header('Link', '</links/1>')\n return normal_formsdict()", "metadata": "root.links", "header": "['module', '___EOS___']", "index": 112 }, { "content": "def run():\n import sys\n try:\n port = int(sys.argv[1])\n except:\n port = 8800\n\n quiet = False\n for arg in sys.argv[1:]:\n if arg == 'quiet':\n quiet = True\n break\n\n bottle.debug(not quiet)\n bottle.run(app=app, host='127.0.0.1', port=port, server='gunicorn',\n quiet=quiet, debug=not quiet,)", "metadata": "root.run", "header": "['module', '___EOS___']", "index": 134 } ]
[ { "span": "except: ", "start_line": 13, "start_column": 8, "end_line": 13, "end_column": 15 }, { "span": "except:", "start_line": 116, "start_column": 4, "end_line": 116, "end_column": 11 }, { "span": "except:", "start_line": 138, "start_column": 4, "end_line": 138, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mb", "\\u", "code_", "(_", "s_", ",_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "c_", "in_", "(_", "'", "utf", "-", "8", "'_", ",_", "'", "gb", "231", "2", "'_", ",_", "'", "gb", "k", "'_", ",_", "'", "gb", "180", "30", "'_", ",_", "'", "big", "5", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "s_", "._", "decode_", "(_", "c_", ")_", "._", "encode_", "(_", "encoding_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "s_", "._", "encode_", "(_", "encoding_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "link", "s", "/", "<", "n", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "links_", "(_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "int_", "(_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "n_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "set\\u", "header_", "(_", "'", "Link", "'_", ",_", "'<", "/", "link", "s", "/", "2", ">", ";", " ", "rel", "=\"", "next", "\",", " ", "</", "link", "s", "/", "3", ">", ";", " ", "rel", "=\"", "last", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "n_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "set\\u", "header_", "(_", "'", "Link", "'_", ",_", "'<", "/", "link", "s", "/", "3", ">", ";", " ", "rel", "=\"", "next", "\",", " ", "</", "link", "s", "/", "3", ">", ";", " ", "rel", "=\"", "last", "\",", " ", "</", "link", "s", "/", "1", ">", ";", " ", "rel", "=\"", "prev", "\",", " ", "</", "link", "s", "/", "1", ">", ";", " ", "rel", "=\"", "first", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "n_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "set\\u", "header_", "(_", "'", "Link", "'_", ",_", "'<", "/", "link", "s", "/", "1", ">", ";", " ", "rel", "=\"", "prev", "\",", " ", "</", "link", "s", "/", "1", ">", ";", " ", "rel", "=\"", "first", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "n_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "set\\u", "header_", "(_", "'", "Link", "'_", ",_", "'<", "/", "link", "s", "/", "none", ">", ";", " ", "rel", "=\"", "self", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "set\\u", "header_", "(_", "'", "Link", "'_", ",_", "'<", "/", "link", "s", "/", "1", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "normal", "\\u", "forms", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port_", "=_", "int_", "(_", "sys_", "._", "argv_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port_", "=_", "880", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "quiet_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "arg_", "in_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "arg_", "==_", "'", "quie", "t", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "quiet_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bottle_", "._", "debug_", "(_", "not_", "quiet_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bottle_", "._", "run_", "(_", "app_", "=_", "app_", ",_", "host_", "=_", "'", "127", ".0", ".0", ".1", "'_", ",_", "port_", "=_", "port_", ",_", "server_", "=_", "'", "gun", "icor", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "quiet_", "=_", "quiet_", ",_", "debug_", "=_", "not_", "quiet_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
ejeschke/ginga/ginga/AstroImage.py
[ { "content": " def mosaic_inline(self, imagelist, bg_ref=None, trim_px=None,\n merge=False, allow_expand=True, expand_pad_deg=0.01,\n max_expand_pct=None,\n update_minmax=True, suppress_callback=False):\n \"\"\"Drops new images into the current image (if there is room),\n relocating them according the WCS between the two images.\n \"\"\"\n # Get our own (mosaic) rotation and scale\n header = self.get_header()\n ((xrot_ref, yrot_ref),\n (cdelt1_ref, cdelt2_ref)) = wcs.get_xy_rotation_and_scale(header)\n ref_rot = yrot_ref\n\n scale_x, scale_y = math.fabs(cdelt1_ref), math.fabs(cdelt2_ref)\n\n # drop each image in the right place in the new data array\n mydata = self._get_data()\n\n count = 1\n for image in imagelist:\n name = image.get('name', 'image%d' % (count))\n count += 1\n\n data_np = image._get_data()\n\n # Calculate sky position at the center of the piece\n ctr_x, ctr_y = trcalc.get_center(data_np)\n ra, dec = image.pixtoradec(ctr_x, ctr_y)\n\n # User specified a trim? If so, trim edge pixels from each\n # side of the array\n ht, wd = data_np.shape[:2]\n if trim_px:\n xlo, xhi = trim_px, wd - trim_px\n ylo, yhi = trim_px, ht - trim_px\n data_np = data_np[ylo:yhi, xlo:xhi, ...]\n ht, wd = data_np.shape[:2]\n\n # If caller asked us to match background of pieces then\n # get the median of this piece\n if bg_ref is not None:\n bg = iqcalc.get_median(data_np)\n bg_inc = bg_ref - bg\n #print \"bg=%f inc=%f\" % (bg, bg_inc)\n data_np = data_np + bg_inc\n\n # Determine max/min to update our values\n if update_minmax:\n maxval = numpy.nanmax(data_np)\n minval = numpy.nanmin(data_np)\n self.maxval = max(self.maxval, maxval)\n self.minval = min(self.minval, minval)\n\n # Get rotation and scale of piece\n header = image.get_header()\n ((xrot, yrot),\n (cdelt1, cdelt2)) = wcs.get_xy_rotation_and_scale(header)\n self.logger.debug(\"image(%s) xrot=%f yrot=%f cdelt1=%f cdelt2=%f\" % (\n name, xrot, yrot, cdelt1, cdelt2))\n\n # scale if necessary\n # TODO: combine with rotation?\n if (not numpy.isclose(math.fabs(cdelt1), scale_x) or\n not numpy.isclose(math.fabs(cdelt2), scale_y)):\n nscale_x = math.fabs(cdelt1) / scale_x\n nscale_y = math.fabs(cdelt2) / scale_y\n self.logger.debug(\"scaling piece by x(%f), y(%f)\" % (\n nscale_x, nscale_y))\n data_np, (ascale_x, ascale_y) = trcalc.get_scaled_cutout_basic(\n data_np, 0, 0, wd-1, ht-1, nscale_x, nscale_y)\n\n # Rotate piece into our orientation, according to wcs\n rot_dx, rot_dy = xrot - xrot_ref, yrot - yrot_ref\n\n flip_x = False\n flip_y = False\n\n ## # Flip X due to negative CDELT1\n ## if numpy.sign(cdelt1) < 0:\n ## flip_x = True\n\n ## # Flip Y due to negative CDELT2\n ## if numpy.sign(cdelt2) < 0:\n ## flip_y = True\n\n # Optomization for 180 rotations\n if numpy.isclose(math.fabs(rot_dx), 180.0):\n flip_x = not flip_x\n rot_dx = 0.0\n if numpy.isclose(math.fabs(rot_dy), 180.0):\n flip_y = not flip_y\n rot_dy = 0.0\n\n self.logger.debug(\"flip_x=%s flip_y=%s\" % (flip_x, flip_y))\n if flip_x or flip_y:\n rotdata = trcalc.transform(data_np,\n flip_x=flip_x, flip_y=flip_y)\n else:\n rotdata = data_np\n\n # Finish with any necessary rotation of piece\n if not numpy.isclose(rot_dy, 0.0):\n rot_deg = rot_dy\n self.logger.debug(\"rotating %s by %f deg\" % (name, rot_deg))\n rotdata = trcalc.rotate(rotdata, rot_deg,\n #rotctr_x=ctr_x, rotctr_y=ctr_y\n )\n\n # Get size and data of new image\n ht, wd = rotdata.shape[:2]\n ctr_x, ctr_y = trcalc.get_center(rotdata)\n\n # Find location of image piece (center) in our array\n x0, y0 = self.radectopix(ra, dec)\n\n # Merge piece as closely as possible into our array\n # Unfortunately we lose a little precision rounding to the\n # nearest pixel--can't be helped with this approach\n x0, y0 = int(round(x0)), int(round(y0))\n self.logger.debug(\"Fitting image '%s' into mosaic at %d,%d\" % (\n name, x0, y0))\n\n # This is for useful debugging info only\n my_ctr_x, my_ctr_y = trcalc.get_center(mydata)\n off_x, off_y = x0 - my_ctr_x, y0 - my_ctr_y\n self.logger.debug(\"centering offsets: %d,%d\" % (off_x, off_y))\n\n # Sanity check piece placement\n xlo, xhi = x0 - ctr_x, x0 + wd - ctr_x\n ylo, yhi = y0 - ctr_y, y0 + ht - ctr_y\n assert (xhi - xlo == wd), \\\n Exception(\"Width differential %d != %d\" % (xhi - xlo, wd))\n assert (yhi - ylo == ht), \\\n Exception(\"Height differential %d != %d\" % (yhi - ylo, ht))\n\n mywd, myht = self.get_size()\n if xlo < 0 or xhi > mywd or ylo < 0 or yhi > myht:\n if not allow_expand:\n raise Exception(\"New piece doesn't fit on image and allow_expand=False\")\n\n #<-- Resize our data array to allow the new image\n\n # determine amount to pad expansion by\n expand_x = max(int(expand_pad_deg / scale_x), 0)\n expand_y = max(int(expand_pad_deg / scale_y), 0)\n\n nx1_off, nx2_off = 0, 0\n if xlo < 0:\n nx1_off = abs(xlo) + expand_x\n if xhi > mywd:\n nx2_off = (xhi - mywd) + expand_x\n xlo, xhi = xlo + nx1_off, xhi + nx1_off\n\n ny1_off, ny2_off = 0, 0\n if ylo < 0:\n ny1_off = abs(ylo) + expand_y\n if yhi > myht:\n ny2_off = (yhi - myht) + expand_y\n ylo, yhi = ylo + ny1_off, yhi + ny1_off\n\n new_wd = mywd + nx1_off + nx2_off\n new_ht = myht + ny1_off + ny2_off\n\n # sanity check on new mosaic size\n old_area = mywd * myht\n new_area = new_wd * new_ht\n expand_pct = new_area / old_area\n if ((max_expand_pct is not None) and\n (expand_pct > max_expand_pct)):\n raise Exception(\"New area exceeds current one by %.2f %%;\"\n \"increase max_expand_pct (%.2f) to allow\" %\n (expand_pct*100, max_expand_pct))\n\n # go for it!\n new_data = numpy.zeros((new_ht, new_wd))\n # place current data into new data\n new_data[ny1_off:ny1_off+myht, nx1_off:nx1_off+mywd] = \\\n mydata\n self._data = new_data\n mydata = new_data\n\n if (nx1_off > 0) or (ny1_off > 0):\n # Adjust our WCS for relocation of the reference pixel\n crpix1, crpix2 = self.get_keywords_list('CRPIX1', 'CRPIX2')\n kwds = dict(CRPIX1=crpix1 + nx1_off,\n CRPIX2=crpix2 + ny1_off)\n self.update_keywords(kwds)\n\n # fit image piece into our array\n try:\n if merge:\n mydata[ylo:yhi, xlo:xhi, ...] += rotdata[0:ht, 0:wd, ...]\n else:\n idx = (mydata[ylo:yhi, xlo:xhi, ...] == 0.0)\n mydata[ylo:yhi, xlo:xhi, ...][idx] = \\\n rotdata[0:ht, 0:wd, ...][idx]\n\n except Exception as e:\n self.logger.error(\"Error fitting tile: %s\" % (str(e)))\n raise\n\n # TODO: recalculate min and max values\n # Can't use usual techniques because it adds too much time to the\n # mosacing\n #self._set_minmax()\n\n # Notify watchers that our data has changed\n if not suppress_callback:\n self.make_callback('modified')\n\n return (xlo, ylo, xhi, yhi)", "metadata": "root.AstroImage.mosaic_inline", "header": "['class', 'AstroImage', '(', 'BaseImage', ')', ':', '___EOS___']", "index": 429 } ]
[ { "span": "rot_dx ", "start_line": 517, "start_column": 16, "end_line": 517, "end_column": 22 } ]
[ { "span": "rot_dx,", "start_line": 501, "start_column": 12, "end_line": 501, "end_column": 18 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Astro", "Image_", "(_", "Base", "Image_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mosaic", "\\u", "inline_", "(_", "self_", ",_", "image", "list_", ",_", "bg", "\\u", "ref_", "=_", "None_", ",_", "trim", "\\u", "px_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "merge_", "=_", "False_", ",_", "allow", "\\u", "expand_", "=_", "True_", ",_", "expand", "\\u", "pad", "\\u", "deg_", "=_", "0.01_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "expand", "\\u", "pct_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "update", "\\u", "minmax", "_", "=_", "True_", ",_", "suppress", "\\u", "callback_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Drop", "s", " ", "new", " ", "images", " ", "int", "o", " ", "the", " ", "current", " ", "image", " ", "(", "if", " ", "there", " ", "is", " ", "room", "),", "\\", "10", ";", " ", " ", " ", " ", "relocat", "ing", " ", "them", " ", "according", " ", "the", " ", "WC", "S", " ", "bet", "ween", " ", "the", " ", "two", " ", "images", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "our", " ", "own", " ", "(", "mosaic", ")", " ", "rotati", "on", " ", "and", " ", "scale_", "\\u\\u\\uNL\\u\\u\\u_", "header_", "=_", "self_", "._", "get", "\\u", "header_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "(_", "xr", "ot", "\\u", "ref_", ",_", "yro", "t", "\\u", "ref_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "cde", "lt", "1", "\\u", "ref_", ",_", "cde", "lt", "2", "\\u", "ref_", ")_", ")_", "=_", "wcs_", "._", "get", "\\u", "xy", "\\u", "rotati", "on", "\\u", "and", "\\u", "scale_", "(_", "header_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "\\u", "rot_", "=_", "yro", "t", "\\u", "ref_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scale", "\\u", "x_", ",_", "scale", "\\u", "y_", "=_", "math_", "._", "fabs_", "(_", "cde", "lt", "1", "\\u", "ref_", ")_", ",_", "math_", "._", "fabs_", "(_", "cde", "lt", "2", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "drop", " ", "each", " ", "image", " ", "in", " ", "the", " ", "right", " ", "place", " ", "in", " ", "the", " ", "new", " ", "data", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "mydat", "a_", "=_", "self_", "._", "\\u", "get", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "count_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "image_", "in_", "image", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "image_", "._", "get_", "(_", "'", "name", "'_", ",_", "'", "image", "%", "d", "'_", "%_", "(_", "count_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "np_", "=_", "image_", "._", "\\u", "get", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Calculat", "e", " ", "sky", " ", "position", " ", "at", " ", "the", " ", "center", " ", "of", " ", "the", " ", "piece_", "\\u\\u\\uNL\\u\\u\\u_", "ctr", "\\u", "x_", ",_", "ctr", "\\u", "y_", "=_", "trc", "alc", "_", "._", "get", "\\u", "center_", "(_", "data\\u", "np_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ra_", ",_", "dec_", "=_", "image_", "._", "pix", "tora", "dec_", "(_", "ctr", "\\u", "x_", ",_", "ctr", "\\u", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "User", " ", "specified", " ", "a", " ", "trim", "?", " ", " ", "If", " ", "so", ",", " ", "trim", " ", "edge", " ", "pixel", "s", " ", "from", " ", "each_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "side", " ", "of", " ", "the", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "ht_", ",_", "wd_", "=_", "data\\u", "np_", "._", "shape_", "[_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "trim", "\\u", "px_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xlo", "_", ",_", "xh", "i_", "=_", "trim", "\\u", "px_", ",_", "wd_", "-_", "trim", "\\u", "px_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ylo", "_", ",_", "yh", "i_", "=_", "trim", "\\u", "px_", ",_", "ht_", "-_", "trim", "\\u", "px_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "np_", "=_", "data\\u", "np_", "[_", "ylo", "_", ":_", "yh", "i_", ",_", "xlo", "_", ":_", "xh", "i_", ",_", "..._", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ht_", ",_", "wd_", "=_", "data\\u", "np_", "._", "shape_", "[_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "caller", " ", "ask", "ed", " ", "us", " ", "to", " ", "match", " ", "background", " ", "of", " ", "piece", "s", " ", "then_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "median", " ", "of", " ", "this", " ", "piece_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "bg", "\\u", "ref_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bg_", "=_", "iq", "calc_", "._", "get", "\\u", "median_", "(_", "data\\u", "np_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bg", "\\u", "inc_", "=_", "bg", "\\u", "ref_", "-_", "bg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "bg", "=", "%", "f", " ", "inc", "=", "%", "f", "\"", " ", "%", " ", "(", "bg", ",", " ", "bg", "\\u", "inc", ")_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "np_", "=_", "data\\u", "np_", "+_", "bg", "\\u", "inc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "max", "/", "min", " ", "to", " ", "update", " ", "our", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "update", "\\u", "minmax", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "maxval_", "=_", "numpy_", "._", "nanm", "ax_", "(_", "data\\u", "np_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "minval_", "=_", "numpy_", "._", "nanm", "in_", "(_", "data\\u", "np_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "maxval_", "=_", "max_", "(_", "self_", "._", "maxval_", ",_", "maxval_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "minval_", "=_", "min_", "(_", "self_", "._", "minval_", ",_", "minval_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "rotati", "on", " ", "and", " ", "scale", " ", "of", " ", "piece_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "header_", "=_", "image_", "._", "get", "\\u", "header_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "(_", "xr", "ot_", ",_", "yro", "t_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "cde", "lt", "1_", ",_", "cde", "lt", "2_", ")_", ")_", "=_", "wcs_", "._", "get", "\\u", "xy", "\\u", "rotati", "on", "\\u", "and", "\\u", "scale_", "(_", "header_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "image", "(%", "s", ")", " ", "xr", "ot", "=", "%", "f", " ", "yro", "t", "=", "%", "f", " ", "cde", "lt", "1", "=", "%", "f", " ", "cde", "lt", "2", "=", "%", "f", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", ",_", "xr", "ot_", ",_", "yro", "t_", ",_", "cde", "lt", "1_", ",_", "cde", "lt", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "scale", " ", "if", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "combin", "e", " ", "with", " ", "rotati", "on", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "not_", "numpy_", "._", "isclose_", "(_", "math_", "._", "fabs_", "(_", "cde", "lt", "1_", ")_", ",_", "scale", "\\u", "x_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "numpy_", "._", "isclose_", "(_", "math_", "._", "fabs_", "(_", "cde", "lt", "2_", ")_", ",_", "scale", "\\u", "y_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nsc", "ale", "\\u", "x_", "=_", "math_", "._", "fabs_", "(_", "cde", "lt", "1_", ")_", "/_", "scale", "\\u", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nsc", "ale", "\\u", "y_", "=_", "math_", "._", "fabs_", "(_", "cde", "lt", "2_", ")_", "/_", "scale", "\\u", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "scal", "ing", " ", "piece", " ", "by", " ", "x", "(%", "f", "),", " ", "y", "(%", "f", ")\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "nsc", "ale", "\\u", "x_", ",_", "nsc", "ale", "\\u", "y_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "np_", ",_", "(_", "asc", "ale", "\\u", "x_", ",_", "asc", "ale", "\\u", "y_", ")_", "=_", "trc", "alc", "_", "._", "get", "\\u", "scale", "d\\u", "cuto", "ut", "\\u", "basic_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "np_", ",_", "0_", ",_", "0_", ",_", "wd_", "-_", "1_", ",_", "ht_", "-_", "1_", ",_", "nsc", "ale", "\\u", "x_", ",_", "nsc", "ale", "\\u", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rotate", " ", "piece", " ", "int", "o", " ", "our", " ", "orientation", ",", " ", "according", " ", "to", " ", "wcs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rot", "\\u", "dx_", ",_", "rot", "\\u", "dy_", "=_", "xr", "ot_", "-_", "xr", "ot", "\\u", "ref_", ",_", "yro", "t_", "-_", "yro", "t", "\\u", "ref_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "flip", "\\u", "x_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flip", "\\u", "y_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "#", " ", "Flip", " ", "X", " ", "due", " ", "to", " ", "negati", "ve", " ", "CD", "EL", "T1_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "if", " ", "nump", "y", ".", "sign", "(", "cde", "lt", "1", ")", " ", "<", " ", "0", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "flip", "\\u", "x", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "#", " ", "Flip", " ", "Y", " ", "due", " ", "to", " ", "negati", "ve", " ", "CD", "EL", "T2_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "if", " ", "nump", "y", ".", "sign", "(", "cde", "lt", "2", ")", " ", "<", " ", "0", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "flip", "\\u", "y", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Opt", "omi", "zatio", "n", " ", "for", " ", "180", " ", "rotations", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "numpy_", "._", "isclose_", "(_", "math_", "._", "fabs_", "(_", "rot", "\\u", "dx_", ")_", ",_", "180.0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flip", "\\u", "x_", "=_", "not_", "flip", "\\u", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rot", "\\u", "dx_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "numpy_", "._", "isclose_", "(_", "math_", "._", "fabs_", "(_", "rot", "\\u", "dy_", ")_", ",_", "180.0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flip", "\\u", "y_", "=_", "not_", "flip", "\\u", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rot", "\\u", "dy_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "flip", "\\u", "x", "=", "%", "s", " ", "flip", "\\u", "y", "=", "%", "s", "\"_", "%_", "(_", "flip", "\\u", "x_", ",_", "flip", "\\u", "y_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "flip", "\\u", "x_", "or_", "flip", "\\u", "y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rot", "data_", "=_", "trc", "alc", "_", "._", "transform_", "(_", "data\\u", "np_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "flip", "\\u", "x_", "=_", "flip", "\\u", "x_", ",_", "flip", "\\u", "y_", "=_", "flip", "\\u", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rot", "data_", "=_", "data\\u", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Finish", " ", "with", " ", "any", " ", "necessar", "y", " ", "rotati", "on", " ", "of", " ", "piece_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "numpy_", "._", "isclose_", "(_", "rot", "\\u", "dy_", ",_", "0.0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rot", "\\u", "deg_", "=_", "rot", "\\u", "dy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "rotati", "ng", " ", "%", "s", " ", "by", " ", "%", "f", " ", "deg", "\"_", "%_", "(_", "name_", ",_", "rot", "\\u", "deg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rot", "data_", "=_", "trc", "alc", "_", "._", "rotate_", "(_", "rot", "data_", ",_", "rot", "\\u", "deg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "rot", "ctr", "\\u", "x", "=", "ctr", "\\u", "x", ",", " ", "rot", "ctr", "\\u", "y", "=", "ctr", "\\u", "y_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "size", " ", "and", " ", "data", " ", "of", " ", "new", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ht_", ",_", "wd_", "=_", "rot", "data_", "._", "shape_", "[_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctr", "\\u", "x_", ",_", "ctr", "\\u", "y_", "=_", "trc", "alc", "_", "._", "get", "\\u", "center_", "(_", "rot", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "location", " ", "of", " ", "image", " ", "piece", " ", "(", "center", ")", " ", "in", " ", "our", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "x0_", ",_", "y0_", "=_", "self_", "._", "rade", "cto", "pix_", "(_", "ra_", ",_", "dec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Merge", " ", "piece", " ", "as", " ", "close", "ly", " ", "as", " ", "possib", "le", " ", "int", "o", " ", "our", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Unf", "ort", "unat", "el", "y", " ", "we", " ", "lose", " ", "a", " ", "litt", "le", " ", "preci", "sion", " ", "rounding", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "near", "est", " ", "pixel", "--", "can", "'", "t", " ", "be", " ", "help", "ed", " ", "with", " ", "this", " ", "appro", "ach", "_", "\\u\\u\\uNL\\u\\u\\u_", "x0_", ",_", "y0_", "=_", "int_", "(_", "round_", "(_", "x0_", ")_", ")_", ",_", "int_", "(_", "round_", "(_", "y0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "Fitt", "ing", " ", "image", " ", "'%", "s", "'", " ", "int", "o", " ", "mosaic", " ", "at", " ", "%", "d", ",%", "d", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", ",_", "x0_", ",_", "y0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "for", " ", "usef", "ul", " ", "debugg", "ing", " ", "info", " ", "only_", "\\u\\u\\uNL\\u\\u\\u_", "my", "\\u", "ctr", "\\u", "x_", ",_", "my", "\\u", "ctr", "\\u", "y_", "=_", "trc", "alc", "_", "._", "get", "\\u", "center_", "(_", "mydat", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "off", "\\u", "x_", ",_", "off", "\\u", "y_", "=_", "x0_", "-_", "my", "\\u", "ctr", "\\u", "x_", ",_", "y0_", "-_", "my", "\\u", "ctr", "\\u", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "center", "ing", " ", "offset", "s", ":", " ", "%", "d", ",%", "d", "\"_", "%_", "(_", "off", "\\u", "x_", ",_", "off", "\\u", "y_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sanit", "y", " ", "check", " ", "piece", " ", "placement_", "\\u\\u\\uNL\\u\\u\\u_", "xlo", "_", ",_", "xh", "i_", "=_", "x0_", "-_", "ctr", "\\u", "x_", ",_", "x0_", "+_", "wd_", "-_", "ctr", "\\u", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ylo", "_", ",_", "yh", "i_", "=_", "y0_", "-_", "ctr", "\\u", "y_", ",_", "y0_", "+_", "ht_", "-_", "ctr", "\\u", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "xh", "i_", "-_", "xlo", "_", "==_", "wd_", ")_", ",_", "Exception_", "(_", "\"", "Wid", "th", " ", "differential", " ", "%", "d", " ", "!=", " ", "%", "d", "\"_", "%_", "(_", "xh", "i_", "-_", "xlo", "_", ",_", "wd_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "yh", "i_", "-_", "ylo", "_", "==_", "ht_", ")_", ",_", "Exception_", "(_", "\"", "Hei", "ght", " ", "differential", " ", "%", "d", " ", "!=", " ", "%", "d", "\"_", "%_", "(_", "yh", "i_", "-_", "ylo", "_", ",_", "ht_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "my", "wd_", ",_", "myh", "t_", "=_", "self_", "._", "get", "\\u", "size_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "xlo", "_", "<_", "0_", "or_", "xh", "i_", ">_", "my", "wd_", "or_", "ylo", "_", "<_", "0_", "or_", "yh", "i_", ">_", "myh", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "allow", "\\u", "expand_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Exception_", "(_", "\"", "New", " ", "piece", " ", "doe", "sn", "'", "t", " ", "fit", " ", "on", " ", "image", " ", "and", " ", "allow", "\\u", "expand", "=", "Fal", "se", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "<-", "-", " ", "Resize", " ", "our", " ", "data", " ", "array", " ", "to", " ", "allow", " ", "the", " ", "new", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dete", "rmin", "e", " ", "amo", "unt", " ", "to", " ", "pad", " ", "expansion", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "expand", "\\u", "x_", "=_", "max_", "(_", "int_", "(_", "expand", "\\u", "pad", "\\u", "deg_", "/_", "scale", "\\u", "x_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expand", "\\u", "y_", "=_", "max_", "(_", "int_", "(_", "expand", "\\u", "pad", "\\u", "deg_", "/_", "scale", "\\u", "y_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nx", "1", "\\u", "off_", ",_", "nx", "2", "\\u", "off_", "=_", "0_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "xlo", "_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "nx", "1", "\\u", "off_", "=_", "abs_", "(_", "xlo", "_", ")_", "+_", "expand", "\\u", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "xh", "i_", ">_", "my", "wd_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "nx", "2", "\\u", "off_", "=_", "(_", "xh", "i_", "-_", "my", "wd_", ")_", "+_", "expand", "\\u", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xlo", "_", ",_", "xh", "i_", "=_", "xlo", "_", "+_", "nx", "1", "\\u", "off_", ",_", "xh", "i_", "+_", "nx", "1", "\\u", "off_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ny", "1", "\\u", "off_", ",_", "ny", "2", "\\u", "off_", "=_", "0_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ylo", "_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ny", "1", "\\u", "off_", "=_", "abs_", "(_", "ylo", "_", ")_", "+_", "expand", "\\u", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "yh", "i_", ">_", "myh", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ny", "2", "\\u", "off_", "=_", "(_", "yh", "i_", "-_", "myh", "t_", ")_", "+_", "expand", "\\u", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ylo", "_", ",_", "yh", "i_", "=_", "ylo", "_", "+_", "ny", "1", "\\u", "off_", ",_", "yh", "i_", "+_", "ny", "1", "\\u", "off_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "wd_", "=_", "my", "wd_", "+_", "nx", "1", "\\u", "off_", "+_", "nx", "2", "\\u", "off_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "ht_", "=_", "myh", "t_", "+_", "ny", "1", "\\u", "off_", "+_", "ny", "2", "\\u", "off_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sanity", " ", "check", " ", "on", " ", "new", " ", "mosaic", " ", "size_", "\\u\\u\\uNL\\u\\u\\u_", "old", "\\u", "area_", "=_", "my", "wd_", "*_", "myh", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "area_", "=_", "new", "\\u", "wd_", "*_", "new", "\\u", "ht_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expand", "\\u", "pct_", "=_", "new", "\\u", "area_", "/_", "old", "\\u", "area_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "(_", "max", "\\u", "expand", "\\u", "pct_", "is_", "not_", "None_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "expand", "\\u", "pct_", ">_", "max", "\\u", "expand", "\\u", "pct_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Exception_", "(_", "\"", "New", " ", "area", " ", "exceed", "s", " ", "current", " ", "one", " ", "by", " ", "%", ".2", "f", " ", "%%", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "increase", " ", "max", "\\u", "expand", "\\u", "pct", " ", "(%", ".2", "f", ")", " ", "to", " ", "allow", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "expand", "\\u", "pct_", "*_", "100_", ",_", "max", "\\u", "expand", "\\u", "pct_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "go", " ", "for", " ", "it", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "data_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "new", "\\u", "ht_", ",_", "new", "\\u", "wd_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "place", " ", "current", " ", "data", " ", "int", "o", " ", "new", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "data_", "[_", "ny", "1", "\\u", "off_", ":_", "ny", "1", "\\u", "off_", "+_", "myh", "t_", ",_", "nx", "1", "\\u", "off_", ":_", "nx", "1", "\\u", "off_", "+_", "my", "wd_", "]_", "=_", "mydat", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "data_", "=_", "new", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mydat", "a_", "=_", "new", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "nx", "1", "\\u", "off_", ">_", "0_", ")_", "or_", "(_", "ny", "1", "\\u", "off_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Adjust", " ", "our", " ", "WC", "S", " ", "for", " ", "relocat", "ion", " ", "of", " ", "the", " ", "reference", " ", "pixel_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cr", "pix", "1_", ",_", "cr", "pix", "2_", "=_", "self_", "._", "get", "\\u", "keywords", "\\u", "list_", "(_", "'", "CR", "PIX", "1", "'_", ",_", "'", "CR", "PIX", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwds_", "=_", "dict_", "(_", "CR", "PIX", "1_", "=_", "cr", "pix", "1_", "+_", "nx", "1", "\\u", "off_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CR", "PIX", "2_", "=_", "cr", "pix", "2_", "+_", "ny", "1", "\\u", "off_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update", "\\u", "keywords_", "(_", "kwds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fit", " ", "image", " ", "piece", " ", "int", "o", " ", "our", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "merge_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "mydat", "a_", "[_", "ylo", "_", ":_", "yh", "i_", ",_", "xlo", "_", ":_", "xh", "i_", ",_", "..._", "]_", "+=_", "rot", "data_", "[_", "0_", ":_", "ht_", ",_", "0_", ":_", "wd_", ",_", "..._", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "idx_", "=_", "(_", "mydat", "a_", "[_", "ylo", "_", ":_", "yh", "i_", ",_", "xlo", "_", ":_", "xh", "i_", ",_", "..._", "]_", "==_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mydat", "a_", "[_", "ylo", "_", ":_", "yh", "i_", ",_", "xlo", "_", ":_", "xh", "i_", ",_", "..._", "]_", "[_", "idx_", "]_", "=_", "rot", "data_", "[_", "0_", ":_", "ht_", ",_", "0_", ":_", "wd_", ",_", "..._", "]_", "[_", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "error_", "(_", "\"", "Error", " ", "fitting", " ", "tile", ":", " ", "%", "s", "\"_", "%_", "(_", "str_", "(_", "e_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "recalc", "ulate", " ", "min", " ", "and", " ", "max", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Can", "'", "t", " ", "use", " ", "usual", " ", "technique", "s", " ", "bec", "aus", "e", " ", "it", " ", "adds", " ", "too", " ", "muc", "h", " ", "time", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mos", "acing", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".\\u", "set\\u", "minmax", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Noti", "fy", " ", "watcher", "s", " ", "tha", "t", " ", "our", " ", "data", " ", "has", " ", "changed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "suppress", "\\u", "callback_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "make", "\\u", "callback_", "(_", "'", "modifi", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "xlo", "_", ",_", "ylo", "_", ",_", "xh", "i_", ",_", "yh", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
tailhook/zorro/zorro/zmq.py
[ { "content": "def rep_responder(sock, address, callback, data):\n hub = core.gethub()\n reply = callback(*data)\n if isinstance(reply, bytes):\n send_data(sock, (reply,), address=address)\n elif isinstance(reply, str):\n send_data(sock, (reply.encode('utf-8'),), address=address)\n elif reply is None:\n raise RuntimeError(\"Replier callback must return either string,\"\n \" bytes or sequence of strings or bytes\")\n else:\n send_data(sock, reply, address=address)", "metadata": "root.rep_responder", "header": "['module', '___EOS___']", "index": 82 } ]
[ { "span": "hub ", "start_line": 83, "start_column": 4, "end_line": 83, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rep", "\\u", "responder", "_", "(_", "sock_", ",_", "address_", ",_", "callback_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hub_", "=_", "core_", "._", "geth", "ub_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reply_", "=_", "callback_", "(_", "*_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "reply_", ",_", "bytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "send", "\\u", "data_", "(_", "sock_", ",_", "(_", "reply_", ",_", ")_", ",_", "address_", "=_", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "reply_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "send", "\\u", "data_", "(_", "sock_", ",_", "(_", "reply_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ",_", ")_", ",_", "address_", "=_", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "reply_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "Repl", "ier", " ", "callback", " ", "must", " ", "return", " ", "eit", "her", " ", "string", ",\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "bytes", " ", "or", " ", "sequence", " ", "of", " ", "string", "s", " ", "or", " ", "bytes", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "send", "\\u", "data_", "(_", "sock_", ",_", "reply_", ",_", "address_", "=_", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
pgiri/dispy/py2/dispy/dispynode.py
[ { "content": "#!/usr/bin/python\n\n\"\"\"\ndispynode: Execute computations on behalf of dispy clients;\nsee accompanying 'dispy' for more details.\n\"\"\"\n\n__author__ = \"Giridhar Pemmasani ([email protected])\"\n__email__ = \"[email protected]\"\n__copyright__ = \"Copyright 2011, Giridhar Pemmasani\"\n__contributors__ = []\n__maintainer__ = \"Giridhar Pemmasani ([email protected])\"\n__license__ = \"MIT\"\n__url__ = \"http://dispy.sourceforge.net\"\n__status__ = \"Production\"\n\nimport os\nimport sys\nimport time\nimport stat\nimport socket\nimport multiprocessing\nimport threading\nimport subprocess\nimport traceback\nimport logging\nimport marshal\nimport tempfile\nimport shutil\nimport glob\nimport functools\nimport inspect\nimport cPickle as pickle\nimport cStringIO as io\ntry:\n import psutil\nexcept ImportError:\n psutil = None\n\nfrom dispy import _JobReply, DispyJob, DispyNodeAvailInfo, _Function, _Compute, _XferFile, \\\n _node_ipaddr, _dispy_version, auth_code, num_min, _same_file, MsgTimeout\n\nimport asyncoro\nfrom asyncoro import Coro, AsynCoro, AsyncSocket, serialize, unserialize\n\n__version__ = _dispy_version\n__all__ = []\n\nMaxFileSize = 0\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n import argparse\n import re\n\n _dispy_logger = asyncoro.Logger('dispynode')\n _dispy_logger.info('dispynode version %s', _dispy_version)\n\n parser = argparse.ArgumentParser()\n parser.add_argument('--config', dest='config', default=None,\n help='use configuration in given file')\n parser.add_argument('--save_config', dest='save_config', default=False, action='store_true',\n help='save configuration in --config file and exit')\n parser.add_argument('-c', '--cpus', dest='cpus', type=int, default=0,\n help='number of cpus used by dispy; if negative, '\n 'that many cpus are not used')\n parser.add_argument('-d', '--debug', action='store_true', dest='loglevel', default=False,\n help='if given, debug messages are printed')\n parser.add_argument('-i', '--ip_addr', dest='ip_addr', default=None,\n help='IP address to use (may be needed in case of multiple interfaces)')\n parser.add_argument('--ext_ip_addr', dest='ext_ip_addr', default=None,\n help='External IP address to use (needed in case of NAT firewall/gateway)')\n parser.add_argument('-p', '--node_port', dest='node_port', type=int, default=51348,\n help='port number to use')\n parser.add_argument('--name', dest='name', type=str, default='',\n help='name asscoiated to this node; default is obtained with gethostname()')\n parser.add_argument('--dest_path_prefix', dest='dest_path_prefix', default=None,\n help='path prefix where files sent by dispy are stored')\n parser.add_argument('--scheduler_node', dest='scheduler_node', default=None,\n help='name or IP address of scheduler to announce when starting')\n parser.add_argument('--scheduler_port', dest='scheduler_port', type=int, default=51347,\n help='port number used by scheduler')\n parser.add_argument('--max_file_size', dest='max_file_size', default=str(MaxFileSize), type=str,\n help='maximum file size of any file transferred (use 0 for unlimited size)')\n parser.add_argument('--zombie_interval', dest='zombie_interval', default=60, type=float,\n help='interval in minutes to presume unresponsive scheduler is zombie')\n parser.add_argument('--service_start', dest='service_start', default=None,\n help='time of day in HH:MM format when to start service')\n parser.add_argument('--service_stop', dest='service_stop', default=None,\n help='time of day in HH:MM format when to stop service '\n '(continue to execute running jobs, but no new jobs scheduled)')\n parser.add_argument('--service_end', dest='service_end', default=None,\n help='time of day in HH:MM format when to end service '\n '(terminate running jobs)')\n parser.add_argument('--serve', dest='serve', default=-1, type=int,\n help='number of clients to serve before exiting')\n parser.add_argument('--msg_timeout', dest='msg_timeout', default=MsgTimeout, type=float,\n help='timeout used for messages to/from client in seconds')\n parser.add_argument('-s', '--secret', dest='secret', default='',\n help='authentication secret for handshake with dispy clients')\n parser.add_argument('--certfile', dest='certfile', default=None,\n help='file containing SSL certificate')\n parser.add_argument('--keyfile', dest='keyfile', default=None,\n help='file containing SSL key')\n parser.add_argument('--clean', action='store_true', dest='clean', default=False,\n help='if given, files copied from or generated by clients will be removed')\n parser.add_argument('--daemon', action='store_true', dest='daemon', default=False,\n help='if given, input is not read from terminal '\n '(to set CPUs or get status)')\n _dispy_config = vars(parser.parse_args(sys.argv[1:]))\n del parser\n\n if _dispy_config['config'] and os.path.isfile(_dispy_config['config']):\n import ConfigParser\n cfgp = ConfigParser.ConfigParser()\n cfgp.read(_dispy_config['config'])\n _dispy_config, cfgp = dict(cfgp.items('DEFAULT')), _dispy_config\n _dispy_config.update(cfgp)\n del cfgp\n\n if _dispy_config['save_config']:\n import ConfigParser\n cfgp = ConfigParser.ConfigParser(_dispy_config)\n if _dispy_config['config']:\n cfgfd = open(_dispy_config['config'], 'w')\n _dispy_config.pop('config')\n else:\n cfgfd = sys.stdout\n _dispy_config.pop('save_config')\n cfgp.write(cfgfd)\n exit(0)\n\n _dispy_config.pop('config', None)\n _dispy_config.pop('save_config', None)\n\n if _dispy_config['loglevel']:\n _dispy_logger.setLevel(logging.DEBUG)\n asyncoro.logger.setLevel(logging.DEBUG)\n else:\n _dispy_logger.setLevel(logging.INFO)\n del _dispy_config['loglevel']\n\n cpus = multiprocessing.cpu_count()\n if _dispy_config['cpus']:\n if _dispy_config['cpus'] > 0:\n if _dispy_config['cpus'] > cpus:\n raise Exception('CPU count must be <= %s' % cpus)\n else:\n if _dispy_config['cpus'] <= -cpus:\n raise Exception('CPU count must be > -%s' % cpus)\n cpus += _dispy_config['cpus']\n _dispy_config['cpus'] = cpus\n else:\n _dispy_config['cpus'] = cpus\n del cpus\n\n if _dispy_config['zombie_interval']:\n _dispy_config['zombie_interval'] = float(_dispy_config['zombie_interval'])\n if _dispy_config['zombie_interval'] < 1:\n raise Exception('zombie_interval must be at least 1')\n\n MsgTimeout = _dispy_config['msg_timeout']\n del _dispy_config['msg_timeout']\n\n m = re.match(r'(\\d+)([kKmMgGtT]?)', _dispy_config['max_file_size'])\n if m:\n MaxFileSize = int(m.group(1))\n if m.group(2):\n m = m.group(2).lower()\n if m == 'k':\n MaxFileSize *= 1024\n elif m == 'm':\n MaxFileSize *= 1024**2\n elif m == 'g':\n MaxFileSize *= 1024**3\n elif m == 't':\n MaxFileSize *= 1024**4\n else:\n raise Exception('invalid max_file_size option')\n else:\n raise Exception('max_file_size must be >= 0')\n del m\n del _dispy_config['max_file_size']\n\n if _dispy_config['service_start']:\n _dispy_config['service_start'] = time.strptime(_dispy_config['service_start'], '%H:%M')\n if _dispy_config['service_stop']:\n _dispy_config['service_stop'] = time.strptime(_dispy_config['service_stop'], '%H:%M')\n if _dispy_config['service_end']:\n _dispy_config['service_end'] = time.strptime(_dispy_config['service_end'], '%H:%M')\n\n try:\n if os.getpgrp() != os.tcgetpgrp(sys.stdin.fileno()):\n _dispy_config['daemon'] = True\n except:\n pass\n\n if psutil:\n psutil.cpu_percent(0.1)\n else:\n print('\\n \"psutil\" module is not available;')\n print(' node status (CPU, memory, disk and swap space usage) '\n 'will not be sent to clients\\n')\n\n _dispy_node = None\n _dispy_node = _DispyNode(**_dispy_config)\n del _dispy_config\n\n _dispy_node.asyncoro.finish()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def dispy_provisional_result(result, timeout=MsgTimeout):\n \"\"\"Sends provisional result of computation back to the client.\n\n In some cases, such as optimizations, computations may send\n current (best) result to the client and continue computation (for\n next iteration) so that the client may decide to terminate\n computations based on the results or alter computations if\n necessary. The computations can use this function in such cases\n with the current result of computation as argument.\n\n 'timeout' is seconds for socket connection/messages; i.e., if\n there is no I/O on socket (to client), this call fails. Default\n value for it is MsgTimeout (5) seconds.\n\n Returns 0 if result was delivered to client.\n \"\"\"\n\n dispy_job_reply = __dispy_job_info.job_reply\n dispy_job_reply.status = DispyJob.ProvisionalResult\n dispy_job_reply.result = result\n dispy_job_reply.end_time = time.time()\n sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n sock = AsyncSocket(sock, blocking=True, keyfile=__dispy_job_keyfile,\n certfile=__dispy_job_certfile)\n sock.settimeout(timeout)\n try:\n sock.connect(__dispy_job_info.reply_addr)\n sock.send_msg('JOB_REPLY:' + serialize(dispy_job_reply))\n ack = sock.recv_msg()\n assert ack == 'ACK'\n except:\n print(\"Couldn't send provisional results %s:\\n%s\" % (str(result), traceback.format_exc()))\n return -1\n else:\n return 0\n finally:\n sock.close()", "metadata": "root.dispy_provisional_result", "header": "['module', '___EOS___']", "index": 51 }, { "content": "def dispy_send_file(path, timeout=MsgTimeout):\n \"\"\"Computations may use this function to send files back to the client.\n\n If the computations have small amount of data to be sent back to\n the client, then the return value can be used for that\n purpose. However, if (temporary) result is stored in file(s), then\n those file(s) can be sent back to the client.\n\n File at given 'path' is sent to the client, which saves the file\n with the same path under its working directory. If multiple jobs\n on different nodes send files, care must be taken to use different\n paths so files sent by one job don't overwrite files sent by other\n jobs.\n\n If file size exceeds 'MaxFileSize' bytes, this function returns -1,\n without sending it.\n\n 'timeout' is seconds for socket connection/messages; i.e., if\n there is no I/O on socket (to client), this call fails. Default\n value for it is MsgTimeout (5) seconds.\n\n Return value of 0 indicates successfull transfer.\n \"\"\"\n\n path = os.path.expanduser(path)\n xf = _XferFile(path, os.stat(path))\n if MaxFileSize and xf.stat_buf.st_size > MaxFileSize:\n return -1\n xf.name = os.path.splitdrive(path)[1]\n if xf.name.startswith(os.sep):\n xf.name = xf.name[len(os.sep):]\n dispy_job_reply = __dispy_job_info.job_reply\n sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n sock = AsyncSocket(sock, blocking=True,\n keyfile=__dispy_job_keyfile, certfile=__dispy_job_certfile)\n sock.settimeout(timeout)\n try:\n sock.connect(__dispy_job_info.reply_addr)\n sock.send_msg('FILEXFER:'.encode() + serialize(xf))\n sock.send_msg(serialize(dispy_job_reply))\n recvd = sock.recv_msg()\n recvd = unserialize(recvd)\n fd = open(path, 'rb')\n sent = 0\n while sent == recvd:\n data = fd.read(1024000)\n if not data:\n break\n sock.sendall(data)\n sent += len(data)\n recvd = sock.recv_msg()\n recvd = unserialize(recvd)\n fd.close()\n assert recvd == xf.stat_buf.st_size\n except:\n print('Could not transfer file \"%s\": %s' % (path, traceback.format_exc()))\n return -1\n else:\n return 0\n finally:\n sock.close()", "metadata": "root.dispy_send_file", "header": "['module', '___EOS___']", "index": 90 }, { "content": "def _dispy_job_func(__dispy_job_info, __dispy_job_certfile, __dispy_job_keyfile,\n __dispy_job_name, __dispy_job_args, __dispy_job_kwargs,\n __dispy_job_code, __dispy_job_globals, __dispy_path, __dispy_reply_Q):\n \"\"\"Internal use only.\n \"\"\"\n\n os.chdir(__dispy_path)\n sys.stdout = io.StringIO()\n sys.stderr = io.StringIO()\n __dispy_job_reply = __dispy_job_info.job_reply\n globals().update(__dispy_job_globals)\n try:\n exec(marshal.loads(__dispy_job_code[0])) in globals()\n if __dispy_job_code[1]:\n exec(__dispy_job_code[1]) in globals()\n __dispy_job_args = unserialize(__dispy_job_args)\n __dispy_job_kwargs = unserialize(__dispy_job_kwargs)\n globals().update(locals())\n exec('__dispy_job_reply.result = %s(*__dispy_job_args, **__dispy_job_kwargs)' %\n __dispy_job_name) in globals()\n __dispy_job_reply.status = DispyJob.Finished\n except:\n __dispy_job_reply.exception = traceback.format_exc()\n __dispy_job_reply.status = DispyJob.Terminated\n __dispy_job_reply.stdout = sys.stdout.getvalue()\n __dispy_job_reply.stderr = sys.stderr.getvalue()\n __dispy_job_reply.end_time = time.time()\n __dispy_job_info.proc = None\n __dispy_reply_Q.put(__dispy_job_reply)", "metadata": "root._dispy_job_func", "header": "['module', '___EOS___']", "index": 166 }, { "content": " def __init__(self, cpus, ip_addr=None, ext_ip_addr=None, node_port=None,\n name='', scheduler_node=None, scheduler_port=None,\n dest_path_prefix='', clean=False, secret='', keyfile=None, certfile=None,\n zombie_interval=60, service_start=None, service_stop=None, service_end=None,\n serve=-1, daemon=False):\n assert 0 < cpus <= multiprocessing.cpu_count()\n self.num_cpus = cpus\n if name:\n self.name = name\n else:\n self.name = socket.gethostname()\n if ip_addr:\n ip_addr = _node_ipaddr(ip_addr)\n if not ip_addr:\n raise Exception('invalid ip_addr')\n else:\n ip_addr = socket.gethostbyname(socket.gethostname())\n if ip_addr.startswith('127.'):\n _dispy_logger.warning('node IP address %s seems to be loopback address; '\n 'this will prevent communication with clients on '\n 'other machines. ', ip_addr)\n if ext_ip_addr:\n ext_ip_addr = _node_ipaddr(ext_ip_addr)\n if not ext_ip_addr:\n raise Exception('invalid ext_ip_addr')\n else:\n ext_ip_addr = ip_addr\n\n if not self.name:\n try:\n self.name = socket.gethostbyaddr(ext_ip_addr)[0]\n except:\n self.name = ''\n\n if node_port is None:\n node_port = 51348\n\n self.ext_ip_addr = ext_ip_addr\n self.pulse_interval = None\n self.keyfile = keyfile\n self.certfile = certfile\n if self.keyfile:\n self.keyfile = os.path.abspath(self.keyfile)\n if self.certfile:\n self.certfile = os.path.abspath(self.certfile)\n\n self.asyncoro = AsynCoro()\n\n self.tcp_sock = AsyncSocket(socket.socket(socket.AF_INET, socket.SOCK_STREAM),\n keyfile=keyfile, certfile=certfile)\n self.tcp_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n self.tcp_sock.bind((ip_addr, node_port))\n self.address = self.tcp_sock.getsockname()\n self.port = self.address[1]\n self.tcp_sock.listen(30)\n\n if not dest_path_prefix:\n dest_path_prefix = os.path.join(tempfile.gettempdir(), 'dispy', 'node')\n self.dest_path_prefix = os.path.abspath(dest_path_prefix.strip()).rstrip(os.sep)\n if clean:\n shutil.rmtree(self.dest_path_prefix, ignore_errors=True)\n if not os.path.isdir(self.dest_path_prefix):\n os.makedirs(self.dest_path_prefix)\n os.chmod(self.dest_path_prefix, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)\n\n self.avail_cpus = self.num_cpus\n self.computations = {}\n self.job_infos = {}\n self.terminate = False\n self.sign = os.urandom(10).encode('hex')\n self.secret = secret\n self.auth = auth_code(self.secret, self.sign)\n self.zombie_interval = 60 * zombie_interval\n if not scheduler_port:\n scheduler_port = 51347\n\n self.scheduler = {'ip_addr': None, 'port': scheduler_port, 'auth': set()}\n self.cpu_time = 0\n self.num_jobs = 0\n self.num_computations = 0\n\n fd = open(os.path.join(self.dest_path_prefix, 'config'), 'wb')\n config = {\n 'ext_ip_addr': self.ext_ip_addr, 'port': self.port, 'avail_cpus': self.avail_cpus,\n 'sign': self.sign, 'secret': self.secret, 'auth': self.auth\n }\n pickle.dump(config, fd)\n fd.close()\n\n # prepend current directory in sys.path so computations can\n # load modules from current working directory\n sys.path.insert(0, '.')\n\n # start a process so all modules needed by dispynode are loaded\n proc = multiprocessing.Process(target=functools.partial(int), args=(42,))\n proc.start()\n proc.join()\n\n self.thread_lock = threading.Lock()\n self.udp_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n self.udp_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n self.udp_sock.bind(('', self.port))\n _dispy_logger.info('serving %s cpus at %s:%s',\n self.num_cpus, self.ext_ip_addr, self.port)\n _dispy_logger.debug('tcp server at %s:%s', self.address[0], self.address[1])\n self.udp_sock = AsyncSocket(self.udp_sock)\n\n self.reply_Q = multiprocessing.Queue()\n self.reply_Q_thread = threading.Thread(target=self.__reply_Q)\n self.reply_Q_thread.start()\n\n self.serve = serve\n self.timer_coro = Coro(self.timer_task)\n self.service_start = self.service_stop = self.service_end = None\n if isinstance(service_start, time.struct_time) and \\\n (isinstance(service_stop, time.struct_time) or\n isinstance(service_end, time.struct_time)):\n self.service_start = (service_start.tm_hour, service_start.tm_min)\n if isinstance(service_stop, time.struct_time):\n self.service_stop = (service_stop.tm_hour, service_stop.tm_min)\n if isinstance(service_end, time.struct_time):\n self.service_end = (service_end.tm_hour, service_end.tm_min)\n Coro(self.service_schedule)\n\n self.__init_code = ''.join(inspect.getsource(dispy_provisional_result))\n self.__init_code += ''.join(inspect.getsource(dispy_send_file))\n self.__init_modules = dict(sys.modules)\n if os.name == 'nt':\n self.__init_globals = dict(globals())\n self.tcp_coro = Coro(self.tcp_server)\n self.udp_coro = Coro(self.udp_server, _node_ipaddr(scheduler_node), scheduler_port)\n if not daemon:\n Coro(self.read_stdin)", "metadata": "root._DispyNode.__init__", "header": "['class', '_DispyNode', '(', 'object', ')', ':', '___EOS___']", "index": 200 }, { "content": " def broadcast_ping_msg(self, coro=None):\n if (self.scheduler['ip_addr'] or self.job_infos or not self.avail_cpus or\n not self.service_available()):\n raise StopIteration\n sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)\n sock = AsyncSocket(sock)\n sock.settimeout(MsgTimeout)\n ping_msg = {'ip_addr': self.ext_ip_addr, 'port': self.port, 'sign': self.sign,\n 'version': _dispy_version, 'scheduler_ip_addr': None}\n try:\n yield sock.sendto('PING:'.encode() + serialize(ping_msg),\n ('<broadcast>', self.scheduler['port']))\n except:\n _dispy_logger.debug(traceback.format_exc())\n pass\n sock.close()", "metadata": "root._DispyNode.broadcast_ping_msg", "header": "['class', '_DispyNode', '(', 'object', ')', ':', '___EOS___']", "index": 334 }, { "content": " def send_pong_msg(self, info, addr, coro=None):\n if (self.scheduler['ip_addr'] or self.job_infos or not self.num_cpus or\n not self.service_available()):\n _dispy_logger.debug('Busy (%s/%s); ignoring ping message from %s',\n self.avail_cpus, self.num_cpus, addr[0])\n raise StopIteration\n try:\n scheduler_ip_addrs = info['ip_addrs']\n if not info.get('relay', None):\n scheduler_ip_addrs.append(addr[0])\n scheduler_port = info['port']\n except:\n _dispy_logger.debug(traceback.format_exc())\n raise StopIteration\n\n if info.get('sign', None):\n pong_msg = {'ip_addr': self.ext_ip_addr, 'port': self.port, 'sign': self.sign,\n 'version': _dispy_version, 'name': self.name, 'cpus': self.avail_cpus,\n 'auth': auth_code(self.secret, info['sign'])}\n if psutil:\n pong_msg['avail_info'] = DispyNodeAvailInfo(\n 100.0 - psutil.cpu_percent(), psutil.virtual_memory().available,\n psutil.disk_usage(self.dest_path_prefix).free,\n 100.0 - psutil.swap_memory().percent)\n else:\n pong_msg['avail_info'] = None\n\n for scheduler_ip_addr in scheduler_ip_addrs:\n addr = (scheduler_ip_addr, scheduler_port)\n pong_msg['scheduler_ip_addr'] = scheduler_ip_addr\n sock = AsyncSocket(socket.socket(socket.AF_INET, socket.SOCK_STREAM),\n keyfile=self.keyfile, certfile=self.certfile)\n sock.settimeout(MsgTimeout)\n try:\n yield sock.connect(addr)\n yield sock.send_msg('PONG:'.encode() + serialize(pong_msg))\n except:\n _dispy_logger.debug('Could not connect to %s:%s', addr[0], addr[1])\n finally:\n sock.close()\n else:\n sock = AsyncSocket(socket.socket(socket.AF_INET, socket.SOCK_DGRAM))\n sock.settimeout(MsgTimeout)\n ping_msg = {'ip_addr': self.ext_ip_addr, 'port': self.port, 'sign': self.sign,\n 'version': _dispy_version}\n for scheduler_ip_addr in scheduler_ip_addrs:\n addr = (scheduler_ip_addr, scheduler_port)\n ping_msg['scheduler_ip_addr'] = scheduler_ip_addr\n try:\n yield sock.sendto('PING:'.encode() + serialize(ping_msg), addr)\n except:\n _dispy_logger.debug(traceback.format_exc())\n pass\n sock.close()", "metadata": "root._DispyNode.send_pong_msg", "header": "['class', '_DispyNode', '(', 'object', ')', ':', '___EOS___']", "index": 352 }, { "content": " def udp_server(self, scheduler_ip, scheduler_port, coro=None):\n coro.set_daemon()\n yield self.broadcast_ping_msg(coro=coro)\n ping_msg = {'ip_addr': self.ext_ip_addr, 'port': self.port, 'sign': self.sign,\n 'version': _dispy_version}\n\n def send_ping_msg(self, info, coro=None):\n sock = AsyncSocket(socket.socket(socket.AF_INET, socket.SOCK_DGRAM))\n sock.settimeout(MsgTimeout)\n addr = (info['ip_addr'], info['port'])\n info.update(ping_msg)\n info['scheduler_ip_addr'] = addr[0]\n try:\n yield sock.sendto('PING:'.encode() + serialize(info), addr)\n except:\n pass\n finally:\n sock.close()\n sock = AsyncSocket(socket.socket(socket.AF_INET, socket.SOCK_STREAM),\n keyfile=self.keyfile, certfile=self.certfile)\n sock.settimeout(MsgTimeout)\n try:\n yield sock.connect(addr)\n yield sock.send_msg('PING:'.encode() + serialize(info))\n except:\n pass\n finally:\n sock.close()\n\n if scheduler_ip:\n Coro(send_ping_msg, self, {'ip_addr': scheduler_ip, 'port': scheduler_port})\n\n while True:\n msg, addr = yield self.udp_sock.recvfrom(1000)\n # TODO: process each message as separate Coro, so\n # exceptions are contained?\n if msg.startswith('PING:'):\n try:\n info = unserialize(msg[len('PING:'):])\n if info['version'] != _dispy_version:\n _dispy_logger.warning('Ignoring %s due to version mismatch', addr[0])\n continue\n except:\n _dispy_logger.debug('Ignoring ping message from %s (%s)', addr[0], addr[1])\n continue\n Coro(self.send_pong_msg, info, addr)\n elif msg.startswith('PULSE:'):\n try:\n info = unserialize(msg[len('PULSE:'):])\n except:\n _dispy_logger.warning('Ignoring PULSE from %s', addr[0])\n else:\n if info['ip_addr'] == self.scheduler['ip_addr']:\n now = time.time()\n for compute in self.computations.itervalues():\n compute.last_pulse = now\n else:\n _dispy_logger.warning('Ignoring ping message from %s', addr[0])", "metadata": "root._DispyNode.udp_server", "header": "['class', '_DispyNode', '(', 'object', ')', ':', '___EOS___']", "index": 407 }, { "content": " def tcp_server(self):\n while 1:\n try:\n conn, addr = yield self.tcp_sock.accept()\n except GeneratorExit:\n break\n except:\n _dispy_logger.debug(traceback.format_exc())\n continue\n Coro(self.tcp_serve_task, conn, addr)", "metadata": "root._DispyNode.tcp_server", "header": "['class', '_DispyNode', '(', 'object', ')', ':', '___EOS___']", "index": 466 }, { "content": " def tcp_serve_task(self, conn, addr, coro=None):\n def job_request_task(msg):\n try:\n _job = unserialize(msg)\n except:\n _dispy_logger.debug('Ignoring job request from %s', addr[0])\n # _dispy_logger.debug(traceback.format_exc())\n raise StopIteration\n\n compute = self.computations.get(_job.compute_id, None)\n if compute is not None:\n if compute.scheduler_ip_addr != self.scheduler['ip_addr'] or \\\n compute.scheduler_port != self.scheduler['port'] or \\\n compute.auth not in self.scheduler['auth']:\n _dispy_logger.debug('Invalid scheduler IP address: scheduler %s:%s != %s:%s',\n compute.scheduler_ip_addr, compute.scheduler_port,\n self.scheduler['ip_addr'], self.scheduler['port'])\n compute = None\n if self.avail_cpus == 0:\n try:\n yield conn.send_msg('NAK (all cpus busy)'.encode())\n except:\n pass\n raise StopIteration\n elif compute is None:\n _dispy_logger.warning('Invalid computation %s', _job.compute_id)\n try:\n yield conn.send_msg(('NAK (invalid computation %s)' %\n _job.compute_id).encode())\n except:\n pass\n raise StopIteration\n\n for xf in _job.xfer_files:\n if MaxFileSize and xf.stat_buf.st_size > MaxFileSize:\n try:\n yield conn.send_msg('NAK'.encode())\n except:\n pass\n raise StopIteration\n\n reply_addr = (compute.scheduler_ip_addr, compute.job_result_port)\n _dispy_logger.debug('New job id %s from %s/%s',\n _job.uid, addr[0], compute.scheduler_ip_addr)\n\n if compute.type == _Compute.func_type:\n reply = _JobReply(_job, self.ext_ip_addr)\n reply.start_time = time.time()\n job_info = _DispyJobInfo(reply, reply_addr, compute, _job.xfer_files)\n\n args = (job_info, self.certfile, self.keyfile, compute.name,\n _job.args, _job.kwargs, (compute.code, _job.code),\n compute.globals, compute.dest_path, self.reply_Q)\n try:\n yield conn.send_msg('ACK')\n except:\n _dispy_logger.warning('Failed to send response for new job to %s', str(addr))\n raise StopIteration\n proc = multiprocessing.Process(target=_dispy_job_func, args=args)\n self.avail_cpus -= 1\n compute.pending_jobs += 1\n self.thread_lock.acquire()\n self.job_infos[_job.uid] = job_info\n self.thread_lock.release()\n try:\n proc.start()\n except:\n job_info.job_reply.status = DispyJob.Terminated\n job_info.job_reply.exception = traceback.format_exc()\n job_info.job_reply.end_time = time.time()\n job_info.proc = None\n self.reply_Q.put(job_info.job_reply)\n else:\n job_info.proc = proc\n job_info.job_reply.status = DispyJob.Running\n raise StopIteration\n elif compute.type == _Compute.prog_type:\n try:\n yield conn.send_msg('ACK')\n except:\n _dispy_logger.warning('Failed to send response for new job to %s', str(addr))\n raise StopIteration\n reply = _JobReply(_job, self.ext_ip_addr)\n reply.start_time = time.time()\n job_info = _DispyJobInfo(reply, reply_addr, compute, _job.xfer_files)\n job_info.job_reply.status = DispyJob.Running\n self.thread_lock.acquire()\n self.job_infos[_job.uid] = job_info\n self.thread_lock.release()\n self.avail_cpus -= 1\n compute.pending_jobs += 1\n prog_thread = threading.Thread(target=self.__job_program, args=(_job, job_info))\n prog_thread.start()\n raise StopIteration\n else:\n try:\n yield conn.send_msg(('NAK (invalid computation type \"%s\")' %\n compute.type).encode())\n except:\n _dispy_logger.warning('Failed to send response for new job to %s', str(addr))\n\n def add_computation_task(msg):\n try:\n compute = unserialize(msg)\n except:\n try:\n yield conn.send_msg(('Invalid computation request ignored').encode())\n except:\n pass\n raise StopIteration\n if not ((self.scheduler['ip_addr'] is None and not self.scheduler['auth']) or\n (self.scheduler['ip_addr'] == compute.scheduler_ip_addr and\n self.scheduler['port'] == compute.scheduler_port and\n self.service_available())):\n _dispy_logger.debug('Ignoring computation request from %s: %s, %s, %s',\n compute.scheduler_ip_addr, self.scheduler['ip_addr'],\n self.avail_cpus, self.num_cpus)\n try:\n yield conn.send_msg(('Node busy').encode())\n except:\n pass\n raise StopIteration\n\n if MaxFileSize:\n for xf in compute.xfer_files:\n if xf.stat_buf.st_size > MaxFileSize:\n try:\n yield conn.send_msg(('File \"%s\" is too big; limit is %s' %\n (xf.name, MaxFileSize)).encode())\n except:\n pass\n raise StopIteration\n compute.xfer_files = set()\n dest = os.path.join(self.dest_path_prefix, compute.scheduler_ip_addr)\n if not os.path.isdir(dest):\n try:\n os.mkdir(dest)\n except:\n yield conn.send_msg(('Could not create destination path').encode())\n raise StopIteration\n if compute.dest_path and isinstance(compute.dest_path, str):\n # TODO: get os.sep from client and convert (in case of mixed environments)?\n if not compute.dest_path.startswith(os.sep):\n compute.dest_path = os.path.join(dest, compute.dest_path)\n if not os.path.isdir(compute.dest_path):\n try:\n os.makedirs(compute.dest_path)\n except:\n try:\n yield conn.send_msg(('Could not create destination path').encode())\n except:\n pass\n raise StopIteration\n else:\n compute.dest_path = tempfile.mkdtemp(prefix=compute.name + '_', dir=dest)\n os.chmod(compute.dest_path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)\n\n if compute.id in self.computations:\n _dispy_logger.warning('Computation \"%s\" (%s) is being replaced',\n compute.name, compute.id)\n setattr(compute, 'last_pulse', time.time())\n setattr(compute, 'pending_jobs', 0)\n setattr(compute, 'pending_results', 0)\n setattr(compute, 'zombie', False)\n setattr(compute, 'globals', {})\n setattr(compute, 'ante_modules', set(sys.modules.iterkeys()))\n setattr(compute, 'file_uses', {})\n\n if compute.code:\n try:\n code = compute.code\n code += self.__init_code\n code = compile(code, '<string>', 'exec')\n except:\n if os.path.isdir(compute.dest_path):\n os.rmdir(compute.dest_path)\n try:\n yield conn.send_msg(('%s: Computation \"%s\" could not be compiled' %\n (self.ext_ip_addr, compute.name)).encode())\n except:\n pass\n raise StopIteration\n compute.code = marshal.dumps(code)\n\n if compute.type == _Compute.prog_type:\n compute.name = os.path.join(compute.dest_path, os.path.basename(compute.name))\n\n if not ((self.scheduler['ip_addr'] is None) or\n (self.scheduler['ip_addr'] == compute.scheduler_ip_addr and\n self.scheduler['port'] == compute.scheduler_port)):\n if os.path.isdir(compute.dest_path):\n try:\n os.rmdir(compute.dest_path)\n yield conn.send_msg(serialize(-1))\n except:\n pass\n raise StopIteration\n\n self.computations[compute.id] = compute\n self.scheduler['ip_addr'] = compute.scheduler_ip_addr\n self.scheduler['port'] = compute.scheduler_port\n self.scheduler['auth'].add(compute.auth)\n compute_save = os.path.join(self.dest_path_prefix, '%s_%s' % (compute.id, compute.auth))\n fd = open(compute_save, 'wb')\n pickle.dump(compute, fd)\n fd.close()\n\n # add variables needed for 'dispy_provisional_result' and\n # 'dispy_send_file' to compute.globals; but in Windows\n # compute.globals can't be passed via multiprocessing.Process\n if os.name == 'nt':\n compute.globals = {}\n else:\n for var in ('AsyncSocket', 'DispyJob', 'serialize', 'unserialize', '_XferFile',\n 'MaxFileSize', 'MsgTimeout'):\n compute.globals[var] = globals()[var]\n compute.globals.update(self.__init_modules)\n compute.globals['_DispyNode'] = None\n\n try:\n yield conn.send_msg(serialize(self.avail_cpus))\n except:\n del self.computations[compute.id]\n compute.globals = {}\n self.scheduler['ip_addr'] = None\n self.scheduler['auth'].discard(compute.auth)\n os.remove(compute_save)\n if os.path.isdir(compute.dest_path):\n try:\n os.rmdir(compute.dest_path)\n except:\n pass\n else:\n self.pulse_interval = num_min(self.pulse_interval, compute.pulse_interval)\n if not self.pulse_interval:\n self.pulse_interval = 10 * 60\n if self.zombie_interval:\n self.pulse_interval = num_min(self.pulse_interval, self.zombie_interval / 5.0)\n self.timer_coro.resume(True)\n\n def xfer_file_task(msg):\n try:\n xf = unserialize(msg)\n except:\n _dispy_logger.debug('Ignoring file trasnfer request from %s', addr[0])\n raise StopIteration\n\n compute = self.computations.get(xf.compute_id, None)\n if not compute or (MaxFileSize and xf.stat_buf.st_size > MaxFileSize):\n _dispy_logger.error('Invalid file transfer for \"%s\"', xf.name)\n yield conn.send_msg(serialize(-1))\n raise StopIteration\n tgt = os.path.join(compute.dest_path, os.path.basename(xf.name))\n if os.path.isfile(tgt) and _same_file(tgt, xf):\n if tgt in compute.file_uses:\n compute.file_uses[tgt] += 1\n else:\n compute.file_uses[tgt] = 2\n yield conn.send_msg(serialize(xf.stat_buf.st_size))\n else:\n try:\n fd = open(tgt, 'wb')\n recvd = 0\n _dispy_logger.debug('Copying file %s to %s (%s)',\n xf.name, tgt, xf.stat_buf.st_size)\n while recvd < xf.stat_buf.st_size:\n yield conn.send_msg(serialize(recvd))\n data = yield conn.recvall(min(xf.stat_buf.st_size-recvd, 1024000))\n if not data:\n break\n fd.write(data)\n recvd += len(data)\n yield conn.send_msg(serialize(recvd))\n fd.close()\n _dispy_logger.debug('Copied file %s, %s / %s',\n tgt, recvd, xf.stat_buf.st_size)\n assert recvd == xf.stat_buf.st_size\n os.utime(tgt, (xf.stat_buf.st_atime, xf.stat_buf.st_mtime))\n os.chmod(tgt, stat.S_IMODE(xf.stat_buf.st_mode))\n except:\n _dispy_logger.warning('Copying file \"%s\" failed with \"%s\"',\n xf.name, traceback.format_exc())\n os.remove(tgt)\n else:\n if tgt in compute.file_uses:\n compute.file_uses[tgt] += 1\n else:\n compute.file_uses[tgt] = 1\n raise StopIteration # xfer_file_task\n\n def setup_computation(msg):\n try:\n compute_id = unserialize(msg)\n compute = self.computations[compute_id]\n assert isinstance(compute.setup, _Function)\n os.chdir(compute.dest_path)\n localvars = {'_dispy_setup_args': compute.setup.args,\n '_dispy_setup_kwargs': compute.setup.kwargs}\n if os.name == 'nt':\n globalvars = globals()\n else:\n globalvars = compute.globals\n exec(marshal.loads(compute.code)) in globalvars, localvars\n exec('assert %s(*_dispy_setup_args, **_dispy_setup_kwargs) == 0' %\n compute.setup.name) in globalvars, localvars\n if os.name == 'nt':\n compute.globals.update({var: globals()[var] for var in globals()\n if var not in self.__init_globals})\n except:\n _dispy_logger.debug('Setup failed')\n resp = traceback.format_exc().encode()\n else:\n resp = 'ACK'\n if resp != 'ACK':\n if not compute.cleanup:\n compute.cleanup = True\n compute.zombie = True\n self.cleanup_computation(compute)\n yield conn.send_msg(resp)\n\n def terminate_job_task(compute, job_info):\n if not job_info.proc:\n raise StopIteration\n _dispy_logger.debug('Terminating job %s of \"%s\"',\n job_info.job_reply.uid, compute.name)\n job_info.proc.terminate()\n if isinstance(job_info.proc, multiprocessing.Process):\n for x in range(20):\n if job_info.proc.is_alive():\n yield coro.sleep(0.1)\n else:\n _dispy_logger.debug('Process \"%s\" for job %s terminated',\n compute.name, job_info.job_reply.uid)\n break\n else:\n _dispy_logger.warning('Could not kill process %s', compute.name)\n raise StopIteration\n else:\n assert isinstance(job_info.proc, subprocess.Popen)\n for x in range(20):\n rc = job_info.proc.poll()\n _dispy_logger.debug('Program \"%s\" for job %s terminated with %s',\n compute.name, job_info.job_reply.uid, rc)\n if rc is not None:\n break\n if x == 10:\n _dispy_logger.debug('Killing job %s', job_info.job_reply.uid)\n job_info.proc.kill()\n yield coro.sleep(0.1)\n else:\n _dispy_logger.warning('Could not kill process %s', compute.name)\n raise StopIteration\n job_info.job_reply.end_time = time.time()\n job_info.proc = None\n self.thread_lock.acquire()\n if self.job_infos.get(job_info.job_reply.uid, None) == job_info:\n job_info.job_reply.status = DispyJob.Terminated\n self.reply_Q.put(job_info.job_reply)\n self.thread_lock.release()\n\n def retrieve_job_task(msg):\n # generator\n\n def send_reply(reply):\n try:\n yield conn.send_msg(serialize(reply))\n except:\n raise StopIteration(-1)\n raise StopIteration(0)\n\n try:\n req = unserialize(msg)\n uid = req['uid']\n compute_id = req['compute_id']\n auth = req['auth']\n job_hash = req['hash']\n except:\n yield send_reply(None)\n raise StopIteration\n\n pkl_path = os.path.join(self.dest_path_prefix, '%s_%s' % (compute_id, auth))\n compute = self.computations.get(compute_id, None)\n if not compute:\n fd = open(pkl_path, 'rb')\n compute = pickle.load(fd)\n fd.close()\n if not compute or compute.auth != auth:\n yield send_reply(None)\n raise StopIteration\n\n info_file = os.path.join(compute.dest_path, '_dispy_job_reply_%s' % uid)\n if not os.path.isfile(info_file):\n yield send_reply(None)\n raise StopIteration\n try:\n fd = open(info_file, 'rb')\n job_reply = pickle.load(fd)\n fd.close()\n assert job_reply.hash == job_hash\n except:\n yield send_reply(None)\n raise StopIteration\n\n try:\n yield conn.send_msg(serialize(job_reply))\n ack = yield conn.recv_msg()\n assert ack == 'ACK'\n compute.pending_results -= 1\n fd = open(pkl_path, 'wb')\n pickle.dump(compute, fd)\n fd.close()\n except:\n pass\n else:\n try:\n os.remove(info_file)\n except:\n pass\n if compute.pending_results == 0:\n self.cleanup_computation(compute)\n\n # tcp_serve_task starts\n try:\n req = yield conn.recvall(len(self.auth))\n except:\n _dispy_logger.warning('Ignoring request; invalid client authentication?')\n conn.close()\n raise StopIteration\n msg = yield conn.recv_msg()\n if req != self.auth:\n if msg.startswith('PING:'):\n pass\n else:\n _dispy_logger.warning('Ignoring request; invalid client authentication?')\n conn.close()\n raise StopIteration\n if not msg:\n conn.close()\n raise StopIteration\n if msg.startswith('JOB:'):\n msg = msg[len('JOB:'):]\n yield job_request_task(msg)\n conn.close()\n elif msg.startswith('COMPUTE:'):\n msg = msg[len('COMPUTE:'):]\n yield add_computation_task(msg)\n conn.close()\n elif msg.startswith('FILEXFER:'):\n msg = msg[len('FILEXFER:'):]\n yield xfer_file_task(msg)\n conn.close()\n elif msg.startswith('SETUP:'):\n msg = msg[len('SETUP:'):]\n yield setup_computation(msg)\n conn.close()\n elif msg.startswith('CLOSE:'):\n msg = msg[len('CLOSE:'):]\n try:\n info = unserialize(msg)\n compute_id = info['compute_id']\n auth = info['auth']\n terminate_pending = info.get('terminate_pending', False)\n except:\n _dispy_logger.debug('Deleting computation failed with %s', traceback.format_exc())\n else:\n compute = self.computations.get(compute_id, None)\n if compute is None or compute.auth != auth:\n _dispy_logger.warning('Computation \"%s\" is not valid', compute_id)\n else:\n compute.zombie = True\n if terminate_pending:\n self.thread_lock.acquire()\n job_infos = [job_info for job_info in self.job_infos.values()\n if job_info.compute_id == compute_id]\n self.thread_lock.release()\n for job_info in job_infos:\n yield terminate_job_task(compute, job_info)\n self.cleanup_computation(compute)\n yield conn.send_msg('ACK')\n conn.close()\n elif msg.startswith('TERMINATE_JOB:'):\n msg = msg[len('TERMINATE_JOB:'):]\n try:\n _job = unserialize(msg)\n compute = self.computations[_job.compute_id]\n # assert addr[0] == compute.scheduler_ip_addr\n self.thread_lock.acquire()\n job_info = self.job_infos.get(_job.uid, None)\n self.thread_lock.release()\n assert job_info is not None\n except:\n _dispy_logger.debug('Invalid terminate job request from %s, %s',\n addr[0], compute.scheduler_ip_addr)\n else:\n yield terminate_job_task(compute, job_info)\n conn.close()\n elif msg.startswith('RESEND_JOB_RESULTS:'):\n msg = msg[len('RESEND_JOB_RESULTS:'):]\n try:\n info = unserialize(msg)\n compute_id = info['compute_id']\n auth = info['auth']\n except:\n reply = 0\n else:\n compute = self.computations.get(compute_id, None)\n if compute is None or compute.auth != auth:\n try:\n fd = open(os.path.join(self.dest_path_prefix,\n '%s_%s' % (compute_id, auth)), 'rb')\n compute = pickle.load(fd)\n fd.close()\n except:\n pass\n if compute is None:\n reply = 0\n else:\n reply = compute.pending_results + compute.pending_jobs\n yield conn.send_msg(serialize(reply))\n conn.close()\n if reply > 0:\n yield self.resend_job_results(compute, coro=coro)\n elif msg.startswith('PING:'):\n try:\n info = unserialize(msg[len('PING:'):])\n if (info['version'] == _dispy_version and\n not self.scheduler['ip_addr'] and not self.job_infos):\n Coro(self.send_pong_msg, info, addr)\n except:\n _dispy_logger.debug(traceback.format_exc())\n conn.close()\n elif msg.startswith('PENDING_JOBS:'):\n msg = msg[len('PENDING_JOBS:'):]\n reply = {'done': [], 'pending': 0}\n try:\n info = unserialize(msg)\n compute_id = info['compute_id']\n auth = info['auth']\n except:\n pass\n else:\n compute = self.computations.get(compute_id, None)\n if compute is None or compute.auth != auth:\n fd = open(os.path.join(self.dest_path_prefix,\n '%s_%s' % (compute_id, auth)), 'rb')\n compute = pickle.load(fd)\n fd.close()\n if compute is not None:\n done = []\n if compute.pending_results:\n for result_file in glob.glob(os.path.join(compute.dest_path,\n '_dispy_job_reply_*')):\n result_file = os.path.basename(result_file)\n try:\n uid = int(result_file[len('_dispy_job_reply_'):])\n except:\n pass\n else:\n done.append(uid)\n # limit so as not to take up too much time\n if len(done) > 50:\n break\n reply['done'] = done\n reply['pending'] = compute.pending_jobs\n yield conn.send_msg(serialize(reply))\n conn.close()\n elif msg.startswith('RETRIEVE_JOB:'):\n msg = msg[len('RETRIEVE_JOB:'):]\n yield retrieve_job_task(msg)\n conn.close()\n else:\n _dispy_logger.warning('Invalid request \"%s\" from %s',\n msg[:min(10, len(msg))], addr[0])\n resp = ('NAK (invalid command: %s)' % (msg[:min(10, len(msg))])).encode()\n try:\n yield conn.send_msg(resp)\n except:\n _dispy_logger.warning('Failed to send reply to %s', str(addr))\n conn.close()", "metadata": "root._DispyNode.tcp_serve_task", "header": "['class', '_DispyNode', '(', 'object', ')', ':', '___EOS___']", "index": 477 }, { "content": " def resend_job_results(self, compute, coro=None):\n # TODO: limit number queued so as not to take up too much space/time\n if not os.path.isdir(compute.dest_path):\n raise StopIteration\n result_files = [f for f in os.listdir(compute.dest_path)\n if f.startswith('_dispy_job_reply_')]\n result_files = result_files[:min(len(result_files), 64)]\n for result_file in result_files:\n result_file = os.path.join(compute.dest_path, result_file)\n try:\n fd = open(result_file, 'rb')\n job_result = pickle.load(fd)\n fd.close()\n except:\n _dispy_logger.debug('Could not load \"%s\"', result_file)\n # _dispy_logger.debug(traceback.format_exc())\n continue\n job_info = _DispyJobInfo(job_result, (compute.scheduler_ip_addr,\n compute.job_result_port), compute, [])\n status = yield self._send_job_reply(job_info, resending=True)\n if status:\n break", "metadata": "root._DispyNode.resend_job_results", "header": "['class', '_DispyNode', '(', 'object', ')', ':', '___EOS___']", "index": 1057 }, { "content": " def __job_program(self, _job, job_info):\n compute = self.computations[_job.compute_id]\n if compute.name.endswith('.py'):\n program = [sys.executable, compute.name]\n else:\n program = [compute.name]\n args = unserialize(_job.args)\n program.extend(args)\n reply = job_info.job_reply\n try:\n os.chdir(compute.dest_path)\n env = {}\n env.update(os.environ)\n env['PATH'] = compute.dest_path + os.pathsep + env['PATH']\n job_info.proc = subprocess.Popen(program, stdout=subprocess.PIPE,\n stderr=subprocess.PIPE, env=env)\n\n assert isinstance(job_info.proc, subprocess.Popen)\n reply.stdout, reply.stderr = job_info.proc.communicate()\n reply.result = job_info.proc.returncode\n reply.status = DispyJob.Finished\n except:\n reply.exception = traceback.format_exc()\n reply.status = DispyJob.Terminated\n reply.end_time = time.time()\n job_info.proc = None\n self.reply_Q.put(reply)", "metadata": "root._DispyNode.__job_program", "header": "['class', '_DispyNode', '(', 'object', ')', ':', '___EOS___']", "index": 1187 }, { "content": " def __reply_Q(self):\n while True:\n job_reply = self.reply_Q.get()\n if job_reply is None:\n break\n self.thread_lock.acquire()\n job_info = self.job_infos.get(job_reply.uid, None)\n if job_info is not None:\n job_info.job_reply = job_reply\n self.thread_lock.release()\n if job_info is not None:\n self.num_jobs += 1\n self.cpu_time += (job_reply.end_time - job_reply.start_time)\n if job_info.proc is not None:\n if isinstance(job_info.proc, multiprocessing.Process):\n job_info.proc.join(2)\n else:\n job_info.proc.wait()\n Coro(self._send_job_reply, job_info, resending=False)\n compute = self.computations.get(job_info.compute_id, None)\n if not compute:\n continue\n for xf in job_info.xfer_files:\n path = os.path.join(compute.dest_path, os.path.basename(xf.name))\n try:\n compute.file_uses[path] -= 1\n if compute.file_uses[path] == 0:\n compute.file_uses.pop(path)\n os.remove(path)\n except:\n _dispy_logger.warning('invalid file \"%s\" ignored', path)\n continue", "metadata": "root._DispyNode.__reply_Q", "header": "['class', '_DispyNode', '(', 'object', ')', ':', '___EOS___']", "index": 1215 }, { "content": " def cleanup_computation(self, compute):\n if not compute.zombie or compute.pending_jobs > 0:\n return\n if compute.pending_jobs != 0:\n _dispy_logger.debug('pending jobs for computation \"%s\"/%s: %s',\n compute.name, compute.id, compute.pending_jobs)\n\n if self.computations.pop(compute.id, None) is None:\n _dispy_logger.warning('Invalid computation \"%s\" to cleanup ignored', compute.id)\n return\n\n self.num_computations += 1\n file_uses, compute.file_uses = compute.file_uses, {}\n globalvars, compute.globals = compute.globals, {}\n pkl_path = os.path.join(self.dest_path_prefix, '%s_%s' % (compute.id, compute.auth))\n if compute.pending_results == 0:\n try:\n os.remove(pkl_path)\n except:\n _dispy_logger.warning('Could not remove \"%s\"', pkl_path)\n else:\n fd = open(pkl_path, 'wb')\n pickle.dump(compute, fd)\n fd.close()\n\n self.scheduler['auth'].discard(compute.auth)\n\n if ((not self.computations) and (not self.scheduler['auth']) and\n compute.scheduler_ip_addr == self.scheduler['ip_addr'] and\n compute.scheduler_port == self.scheduler['port']):\n self.scheduler['ip_addr'] = None\n self.pulse_interval = None\n self.timer_coro.resume(None)\n if self.serve > 0:\n self.serve -= 1\n Coro(self.broadcast_ping_msg)\n\n if compute.cleanup is False:\n if self.serve == 0:\n self.shutdown(quit=True)\n return\n os.chdir(self.dest_path_prefix)\n if isinstance(compute.cleanup, _Function):\n try:\n localvars = {'_dispy_cleanup_args': compute.cleanup.args,\n '_dispy_cleanup_kwargs': compute.cleanup.kwargs}\n if os.name == 'nt':\n globalvars = globals()\n exec(marshal.loads(compute.code)) in globalvars, localvars\n exec('%s(*_dispy_cleanup_args, **_dispy_cleanup_kwargs)' %\n compute.cleanup.name) in globalvars, localvars\n except:\n _dispy_logger.debug('Cleanup \"%s\" failed', compute.cleanup.name)\n _dispy_logger.debug(traceback.format_exc())\n\n if os.name == 'nt':\n for var in globals().keys():\n if var not in self.__init_globals:\n _dispy_logger.debug('Variable \"%s\" left behind by \"%s\" at %s is being removed',\n var, compute.name, compute.scheduler_ip_addr)\n globals().pop(var, None)\n\n for var, value in self.__init_globals.iteritems():\n if var in ('_dispy_node', '_dispy_conn', '_dispy_addr', '_dispy_config'):\n continue\n if value != globals().get(var, None):\n _dispy_logger.warning('Variable \"%s\" changed by \"%s\" at %s is being reset',\n var, compute.name, compute.scheduler_ip_addr)\n globals()[var] = value\n\n for module in sys.modules.keys():\n if module not in compute.ante_modules:\n sys.modules.pop(module, None)\n sys.modules.update(self.__init_modules)\n\n for path in os.listdir(compute.dest_path):\n path = os.path.join(compute.dest_path, path)\n if file_uses.get(path, 1) == 1:\n try:\n if os.path.isfile(path) or os.path.islink(path):\n os.remove(path)\n elif os.path.isdir(path):\n shutil.rmtree(path, ignore_errors=True)\n else:\n os.remove(path)\n except:\n _dispy_logger.warning('Could not remove \"%s\"', path)\n\n if os.path.isdir(compute.dest_path) and \\\n compute.dest_path.startswith(self.dest_path_prefix) and \\\n len(os.listdir(compute.dest_path)) == 0:\n try:\n os.rmdir(compute.dest_path)\n except:\n _dispy_logger.warning('Could not remove directory \"%s\"', compute.dest_path)\n else:\n _dispy_logger.debug('Removed \"%s\"', compute.dest_path)\n\n if self.serve == 0:\n self.shutdown(quit=True)", "metadata": "root._DispyNode.cleanup_computation", "header": "['class', '_DispyNode', '(', 'object', ')', ':', '___EOS___']", "index": 1323 }, { "content": " def shutdown(self, quit=True):\n def _shutdown(self, quit, coro=None):\n self.thread_lock.acquire()\n job_infos, self.job_infos = self.job_infos, {}\n if quit and self.reply_Q:\n self.reply_Q.put(None)\n self.scheduler['ip_addr'] = None\n self.scheduler['auth'] = set()\n self.avail_cpus += len(job_infos)\n if self.avail_cpus != self.num_cpus:\n _dispy_logger.warning('invalid cpus: %s / %s', self.avail_cpus, self.num_cpus)\n self.thread_lock.release()\n for uid, job_info in job_infos.iteritems():\n job_info.proc.terminate()\n _dispy_logger.debug('process for %s is killed', uid)\n if isinstance(job_info.proc, multiprocessing.Process):\n job_info.proc.join(2)\n else:\n job_info.proc.wait()\n for cid, compute in self.computations.items():\n sock = AsyncSocket(socket.socket(socket.AF_INET, socket.SOCK_STREAM),\n keyfile=self.keyfile, certfile=self.certfile)\n sock.settimeout(MsgTimeout)\n _dispy_logger.debug('Sending TERMINATE to %s', compute.scheduler_ip_addr)\n info = {'ip_addr': self.ext_ip_addr, 'port': self.port, 'sign': self.sign}\n try:\n yield sock.connect((compute.scheduler_ip_addr, compute.scheduler_port))\n yield sock.send_msg('TERMINATED:'.encode() + serialize(info))\n except:\n pass\n sock.close()\n compute.pending_jobs = 0\n compute.zombie = True\n self.cleanup_computation(compute)\n if quit:\n self.tcp_coro.terminate()\n self.sign = ''\n\n if self.sign:\n Coro(_shutdown, self, quit)", "metadata": "root._DispyNode.shutdown", "header": "['class', '_DispyNode', '(', 'object', ')', ':', '___EOS___']", "index": 1424 }, { "content": " def read_stdin(self, coro=None):\n coro.set_daemon()\n thread_pool = asyncoro.AsyncThreadPool(1)\n while True:\n sys.stdout.write('\\nEnter \"quit\" or \"exit\" to terminate dispynode,\\n'\n ' \"stop\" to stop service, \"start\" to restart service,\\n'\n ' \"cpus\" to change CPUs used, anything else to get status: ')\n sys.stdout.flush()\n try:\n cmd = yield thread_pool.async_task(raw_input)\n except:\n continue\n\n cmd = cmd.strip().lower()\n if cmd in ('quit', 'exit'):\n break\n elif cmd in ('stop', 'start', 'cpus'):\n if cmd == 'stop':\n cpus = 0\n elif cmd == 'start':\n cpus = self.num_cpus\n elif cmd == 'cpus':\n cpus = multiprocessing.cpu_count()\n sys.stdout.write('Enter number of CPUs to use in range -%s to %s: ' %\n (cpus - 1, cpus))\n sys.stdout.flush()\n try:\n cpus = yield thread_pool.async_task(raw_input)\n cpus = int(cpus)\n if cpus >= 0:\n assert cpus <= multiprocessing.cpu_count()\n else:\n cpus += multiprocessing.cpu_count()\n assert cpus >= 0\n except:\n print(' Invalid cpus ignored')\n continue\n self.num_cpus = cpus\n\n self.avail_cpus = cpus - len(self.job_infos)\n\n if self.scheduler['ip_addr']:\n sock = AsyncSocket(socket.socket(socket.AF_INET, socket.SOCK_STREAM),\n keyfile=self.keyfile, certfile=self.certfile)\n sock.settimeout(MsgTimeout)\n try:\n yield sock.connect((self.scheduler['ip_addr'], self.scheduler['port']))\n info = {'ip_addr': self.ext_ip_addr, 'sign': self.sign, 'cpus': cpus}\n yield sock.send_msg('NODE_CPUS:'.encode() + serialize(info))\n except:\n pass\n finally:\n sock.close()\n else:\n if self.num_cpus > 0:\n Coro(self.broadcast_ping_msg)\n else:\n print('\\n Serving %d CPUs%s%s%s' %\n (self.avail_cpus + len(self.job_infos),\n ' from %s' % self.serivce_start if self.service_start else '',\n ' to %s' % self.service_end if self.service_end else '',\n ' for %d clients' % self.serve if self.serve > 0 else ''))\n print(' Completed:\\n %d Computations, %d jobs, %.3f sec CPU time' %\n (self.num_computations, self.num_jobs, self.cpu_time))\n print(' Running:')\n for i, compute in enumerate(self.computations.itervalues(), start=1):\n print(' Client %s: %s @ %s running %s jobs' %\n (i, compute.name, compute.scheduler_ip_addr, compute.pending_jobs))\n print('')\n self.shutdown(quit=True)", "metadata": "root._DispyNode.read_stdin", "header": "['class', '_DispyNode', '(', 'object', ')', ':', '___EOS___']", "index": 1465 } ]
[ { "span": "except:", "start_line": 1679, "start_column": 4, "end_line": 1679, "end_column": 11 }, { "span": "except:", "start_line": 81, "start_column": 4, "end_line": 81, "end_column": 11 }, { "span": "except:", "start_line": 144, "start_column": 4, "end_line": 144, "end_column": 11 }, { "span": "except:", "start_line": 187, "start_column": 4, "end_line": 187, "end_column": 11 }, { "span": "except:", "start_line": 231, "start_column": 12, "end_line": 231, "end_column": 19 }, { "span": "except:", "start_line": 347, "start_column": 8, "end_line": 347, "end_column": 15 }, { "span": "except:", "start_line": 388, "start_column": 16, "end_line": 388, "end_column": 23 }, { "span": "except:", "start_line": 402, "start_column": 16, "end_line": 402, "end_column": 23 }, { "span": "except:", "start_line": 421, "start_column": 12, "end_line": 421, "end_column": 19 }, { "span": "except:", "start_line": 431, "start_column": 12, "end_line": 431, "end_column": 19 }, { "span": "except:", "start_line": 472, "start_column": 12, "end_line": 472, "end_column": 19 }, { "span": "except:", "start_line": 575, "start_column": 16, "end_line": 575, "end_column": 23 }, { "span": "except:", "start_line": 698, "start_column": 12, "end_line": 698, "end_column": 19 }, { "span": "except:", "start_line": 707, "start_column": 20, "end_line": 707, "end_column": 27 }, { "span": "except:", "start_line": 785, "start_column": 12, "end_line": 785, "end_column": 19 }, { "span": "except:", "start_line": 888, "start_column": 12, "end_line": 888, "end_column": 19 }, { "span": "except:", "start_line": 893, "start_column": 16, "end_line": 893, "end_column": 23 }, { "span": "except:", "start_line": 939, "start_column": 12, "end_line": 939, "end_column": 19 }, { "span": "except:", "start_line": 967, "start_column": 12, "end_line": 967, "end_column": 19 }, { "span": "except:", "start_line": 979, "start_column": 12, "end_line": 979, "end_column": 19 }, { "span": "except:", "start_line": 989, "start_column": 20, "end_line": 989, "end_column": 27 }, { "span": "except:", "start_line": 1005, "start_column": 12, "end_line": 1005, "end_column": 19 }, { "span": "except:", "start_line": 1015, "start_column": 12, "end_line": 1015, "end_column": 19 }, { "span": "except:", "start_line": 1032, "start_column": 28, "end_line": 1032, "end_column": 35 }, { "span": "except:", "start_line": 1053, "start_column": 12, "end_line": 1053, "end_column": 19 }, { "span": "except:", "start_line": 1070, "start_column": 12, "end_line": 1070, "end_column": 19 }, { "span": "except:", "start_line": 1208, "start_column": 8, "end_line": 1208, "end_column": 15 }, { "span": "except:", "start_line": 1244, "start_column": 20, "end_line": 1244, "end_column": 27 }, { "span": "except:", "start_line": 1341, "start_column": 12, "end_line": 1341, "end_column": 19 }, { "span": "except:", "start_line": 1374, "start_column": 12, "end_line": 1374, "end_column": 19 }, { "span": "except:", "start_line": 1408, "start_column": 16, "end_line": 1408, "end_column": 23 }, { "span": "except:", "start_line": 1416, "start_column": 12, "end_line": 1416, "end_column": 19 }, { "span": "except:", "start_line": 1452, "start_column": 16, "end_line": 1452, "end_column": 23 }, { "span": "except:", "start_line": 1475, "start_column": 12, "end_line": 1475, "end_column": 19 }, { "span": "except:", "start_line": 1499, "start_column": 20, "end_line": 1499, "end_column": 27 }, { "span": "except:", "start_line": 1514, "start_column": 20, "end_line": 1514, "end_column": 27 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "disp", "yn", "ode", ":", " ", "Execut", "e", " ", "computation", "s", " ", "on", " ", "beha", "lf", " ", "of", " ", "disp", "y", " ", "clients", ";", "\\", "10", ";", "see", " ", "accom", "pan", "ying", " ", "'", "disp", "y", "'", " ", "for", " ", "more", " ", "deta", "il", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "\"", "Gir", "id", "har", " ", "Pe", "mma", "sani", " ", "(", "pg", "iri", "@", "ya", "hoo", ".", "com", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "email\\u\\u_", "=_", "\"", "pg", "iri", "@", "ya", "hoo", ".", "com", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "copyright\\u\\u_", "=_", "\"", "Copy", "right", " ", "2011", ",", " ", "Gir", "id", "har", " ", "Pe", "mma", "sani", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "contributor", "s\\u\\u_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "maintainer\\u\\u_", "=_", "\"", "Gir", "id", "har", " ", "Pe", "mma", "sani", " ", "(", "pg", "iri", "@", "ya", "hoo", ".", "com", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "license\\u\\u_", "=_", "\"", "MIT", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "url", "\\u\\u_", "=_", "\"", "http", "://", "disp", "y", ".", "sourcef", "org", "e", ".", "net", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "status\\u\\u_", "=_", "\"", "Product", "ion", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "stat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "multiprocessing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "marshal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "functools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "inspect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "c", "Pickle_", "as_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "c", "String", "IO_", "as_", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "psutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "psutil_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "disp", "y_", "import_", "\\u", "Jo", "b", "Reply_", ",_", "Disp", "y", "Job_", ",_", "Disp", "y", "Node", "Avail", "Info_", ",_", "\\u", "Function_", ",_", "\\u", "Compute", "_", ",_", "\\u", "Xf", "er", "File_", ",_", "\\u", "node", "\\u", "ipaddr_", ",_", "\\u", "disp", "y", "\\u", "version_", ",_", "auth", "\\u", "code_", ",_", "num", "\\u", "min_", ",_", "\\u", "same", "\\u", "file_", ",_", "Msg", "Timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "async", "oro", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "async", "oro", "_", "import_", "Cor", "o_", ",_", "As", "yn", "Cor", "o_", ",_", "Async", "Socket_", ",_", "serialize_", ",_", "unse", "rial", "ize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "\\u", "disp", "y", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Max", "File", "Size_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disp", "y", "\\u", "logger_", "=_", "async", "oro", "_", "._", "Logger_", "(_", "'", "disp", "yn", "ode", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disp", "y", "\\u", "logger_", "._", "info_", "(_", "'", "disp", "yn", "ode", " ", "version", " ", "%", "s", "'_", ",_", "\\u", "disp", "y", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "config", "'_", ",_", "dest_", "=_", "'", "config", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "use", " ", "configura", "tion", " ", "in", " ", "give", "n", " ", "file", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "save", "\\u", "config", "'_", ",_", "dest_", "=_", "'", "save", "\\u", "config", "'_", ",_", "default_", "=_", "False_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "save", " ", "configura", "tion", " ", "in", " ", "--", "config", " ", "file", " ", "and", " ", "exit", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "c", "'_", ",_", "'--", "cpus", "'_", ",_", "dest_", "=_", "'", "cpus", "'_", ",_", "type_", "=_", "int_", ",_", "default_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "number", " ", "of", " ", "cpus", " ", "used", " ", "by", " ", "disp", "y", ";", " ", "if", " ", "negati", "ve", ",", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tha", "t", " ", "many", " ", "cpus", " ", "are", " ", "not", " ", "used", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "d", "'_", ",_", "'--", "debug", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "dest_", "=_", "'", "logl", "evel", "'_", ",_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "if", " ", "give", "n", ",", " ", "debug", " ", "message", "s", " ", "are", " ", "printed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "i", "'_", ",_", "'--", "ip", "\\u", "addr", "'_", ",_", "dest_", "=_", "'", "ip", "\\u", "addr", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "IP", " ", "address", " ", "to", " ", "use", " ", "(", "may", " ", "be", " ", "need", "ed", " ", "in", " ", "case", " ", "of", " ", "multiple", " ", "interface", "s", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "ext", "\\u", "ip", "\\u", "addr", "'_", ",_", "dest_", "=_", "'", "ext", "\\u", "ip", "\\u", "addr", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Exter", "nal", " ", "IP", " ", "address", " ", "to", " ", "use", " ", "(", "need", "ed", " ", "in", " ", "case", " ", "of", " ", "NAT", " ", "firew", "all", "/", "gateway", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "p", "'_", ",_", "'--", "node", "\\u", "port", "'_", ",_", "dest_", "=_", "'", "node", "\\u", "port", "'_", ",_", "type_", "=_", "int_", ",_", "default_", "=_", "513", "48_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "port", " ", "number", " ", "to", " ", "use", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "name", "'_", ",_", "dest_", "=_", "'", "name", "'_", ",_", "type_", "=_", "str_", ",_", "default_", "=_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "name", " ", "ass", "co", "iate", "d", " ", "to", " ", "this", " ", "node", ";", " ", "default", " ", "is", " ", "obtain", "ed", " ", "with", " ", "geth", "ost", "name", "()'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "dest", "\\u", "path", "\\u", "prefix", "'_", ",_", "dest_", "=_", "'", "dest", "\\u", "path", "\\u", "prefix", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "path", " ", "prefix", " ", "where", " ", "files", " ", "sent", " ", "by", " ", "disp", "y", " ", "are", " ", "store", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "schedule", "r", "\\u", "node", "'_", ",_", "dest_", "=_", "'", "schedule", "r", "\\u", "node", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "name", " ", "or", " ", "IP", " ", "address", " ", "of", " ", "schedule", "r", " ", "to", " ", "announce", " ", "whe", "n", " ", "startin", "g", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "schedule", "r", "\\u", "port", "'_", ",_", "dest_", "=_", "'", "schedule", "r", "\\u", "port", "'_", ",_", "type_", "=_", "int_", ",_", "default_", "=_", "513", "47_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "port", " ", "number", " ", "used", " ", "by", " ", "schedule", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "max", "\\u", "file", "\\u", "size", "'_", ",_", "dest_", "=_", "'", "max", "\\u", "file", "\\u", "size", "'_", ",_", "default_", "=_", "str_", "(_", "Max", "File", "Size_", ")_", ",_", "type_", "=_", "str_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "maxim", "um", " ", "file", " ", "size", " ", "of", " ", "any", " ", "file", " ", "transferred", " ", "(", "use", " ", "0", " ", "for", " ", "unlimited", " ", "size", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "zombie", "\\u", "interval", "'_", ",_", "dest_", "=_", "'", "zombie", "\\u", "interval", "'_", ",_", "default_", "=_", "60_", ",_", "type_", "=_", "float_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "interval", " ", "in", " ", "minute", "s", " ", "to", " ", "presu", "me", " ", "unres", "pon", "sive", " ", "schedule", "r", " ", "is", " ", "zombie", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "service", "\\u", "start", "'_", ",_", "dest_", "=_", "'", "service", "\\u", "start", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "time", " ", "of", " ", "day", " ", "in", " ", "HH", ":", "MM", " ", "format", " ", "whe", "n", " ", "to", " ", "start", " ", "service", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "service", "\\u", "stop", "'_", ",_", "dest_", "=_", "'", "service", "\\u", "stop", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "time", " ", "of", " ", "day", " ", "in", " ", "HH", ":", "MM", " ", "format", " ", "whe", "n", " ", "to", " ", "stop", " ", "service", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "continue", " ", "to", " ", "execute", " ", "runn", "ing", " ", "jobs", ",", " ", "but", " ", "no", " ", "new", " ", "jobs", " ", "schedule", "d", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "service", "\\u", "end", "'_", ",_", "dest_", "=_", "'", "service", "\\u", "end", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "time", " ", "of", " ", "day", " ", "in", " ", "HH", ":", "MM", " ", "format", " ", "whe", "n", " ", "to", " ", "end", " ", "service", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "terminate", " ", "runn", "ing", " ", "jobs", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "serve", "'_", ",_", "dest_", "=_", "'", "serve", "'_", ",_", "default_", "=_", "-_", "1_", ",_", "type_", "=_", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "number", " ", "of", " ", "clients", " ", "to", " ", "serve", " ", "bef", "ore", " ", "exit", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "msg", "\\u", "timeo", "ut", "'_", ",_", "dest_", "=_", "'", "msg", "\\u", "timeo", "ut", "'_", ",_", "default_", "=_", "Msg", "Timeout_", ",_", "type_", "=_", "float_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "timeo", "ut", " ", "used", " ", "for", " ", "message", "s", " ", "to", "/", "from", " ", "client", " ", "in", " ", "second", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "s", "'_", ",_", "'--", "secret", "'_", ",_", "dest_", "=_", "'", "secret", "'_", ",_", "default_", "=_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "authenticat", "ion", " ", "secret", " ", "for", " ", "handshake", " ", "with", " ", "disp", "y", " ", "clients", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "certfile", "'_", ",_", "dest_", "=_", "'", "certfile", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "file", " ", "contain", "ing", " ", "SS", "L", " ", "certifica", "te", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "keyfile", "'_", ",_", "dest_", "=_", "'", "keyfile", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "file", " ", "contain", "ing", " ", "SS", "L", " ", "key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "clean", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "dest_", "=_", "'", "clean", "'_", ",_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "if", " ", "give", "n", ",", " ", "files", " ", "copie", "d", " ", "from", " ", "or", " ", "generat", "ed", " ", "by", " ", "clients", " ", "will", " ", "be", " ", "remove", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "daemon", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "dest_", "=_", "'", "daemon", "'_", ",_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "if", " ", "give", "n", ",", " ", "input", " ", "is", " ", "not", " ", "read", " ", "from", " ", "termina", "l", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "to", " ", "set", " ", "CPU", "s", " ", "or", " ", "get", " ", "status", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disp", "y", "\\u", "config_", "=_", "vars_", "(_", "parser_", "._", "parse", "\\u", "args_", "(_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "config", "'_", "]_", "and_", "os_", "._", "path_", "._", "isfile_", "(_", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "config", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "Config", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg", "p_", "=_", "Config", "Parser_", "._", "Config", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg", "p_", "._", "read_", "(_", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "config", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disp", "y", "\\u", "config_", ",_", "cfg", "p_", "=_", "dict_", "(_", "cfg", "p_", "._", "items_", "(_", "'", "DEF", "AUL", "T", "'_", ")_", ")_", ",_", "\\u", "disp", "y", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disp", "y", "\\u", "config_", "._", "update_", "(_", "cfg", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "cfg", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "save", "\\u", "config", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "Config", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg", "p_", "=_", "Config", "Parser_", "._", "Config", "Parser_", "(_", "\\u", "disp", "y", "\\u", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "config", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cfg", "fd_", "=_", "open_", "(_", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "config", "'_", "]_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disp", "y", "\\u", "config_", "._", "pop_", "(_", "'", "config", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cfg", "fd_", "=_", "sys_", "._", "stdout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disp", "y", "\\u", "config_", "._", "pop_", "(_", "'", "save", "\\u", "config", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg", "p_", "._", "write_", "(_", "cfg", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disp", "y", "\\u", "config_", "._", "pop_", "(_", "'", "config", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disp", "y", "\\u", "config_", "._", "pop_", "(_", "'", "save", "\\u", "config", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "logl", "evel", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "set", "Level_", "(_", "logging_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "async", "oro", "_", "._", "logger_", "._", "set", "Level_", "(_", "logging_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "set", "Level_", "(_", "logging_", "._", "INFO_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "logl", "evel", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cpus_", "=_", "multiprocessing_", "._", "cpu", "\\u", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "cpus", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "cpus", "'_", "]_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "cpus", "'_", "]_", ">_", "cpus_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "CPU", " ", "count", " ", "must", " ", "be", " ", "<=", " ", "%", "s", "'_", "%_", "cpus_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "cpus", "'_", "]_", "<=_", "-_", "cpus_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "CPU", " ", "count", " ", "must", " ", "be", " ", ">", " ", "-%", "s", "'_", "%_", "cpus_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cpus_", "+=_", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "cpus", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "cpus", "'_", "]_", "=_", "cpus_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "cpus", "'_", "]_", "=_", "cpus_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "cpus_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "zombie", "\\u", "interval", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "zombie", "\\u", "interval", "'_", "]_", "=_", "float_", "(_", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "zombie", "\\u", "interval", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "zombie", "\\u", "interval", "'_", "]_", "<_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "zombie", "\\u", "interval", " ", "must", " ", "be", " ", "at", " ", "leas", "t", " ", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Msg", "Timeout_", "=_", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "msg", "\\u", "timeo", "ut", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "msg", "\\u", "timeo", "ut", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "=_", "re_", "._", "match_", "(_", "r", "'(\\\\", "d", "+)(", "[", "k", "Km", "Mg", "Gt", "T", "]?", ")'_", ",_", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "max", "\\u", "file", "\\u", "size", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Max", "File", "Size_", "=_", "int_", "(_", "m_", "._", "group_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", "._", "group_", "(_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "m_", "._", "group_", "(_", "2_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", "==_", "'", "k", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Max", "File", "Size_", "*=_", "1024_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "m_", "==_", "'", "m", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Max", "File", "Size_", "*=_", "1024_", "**_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "m_", "==_", "'", "g", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Max", "File", "Size_", "*=_", "1024_", "**_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "m_", "==_", "'", "t", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Max", "File", "Size_", "*=_", "1024_", "**_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "invalid", " ", "max", "\\u", "file", "\\u", "size", " ", "option", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "max", "\\u", "file", "\\u", "size", " ", "must", " ", "be", " ", ">=", " ", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "max", "\\u", "file", "\\u", "size", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "service", "\\u", "start", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "service", "\\u", "start", "'_", "]_", "=_", "time_", "._", "strptime_", "(_", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "service", "\\u", "start", "'_", "]_", ",_", "'%", "H", ":", "%", "M", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "service", "\\u", "stop", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "service", "\\u", "stop", "'_", "]_", "=_", "time_", "._", "strptime_", "(_", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "service", "\\u", "stop", "'_", "]_", ",_", "'%", "H", ":", "%", "M", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "service", "\\u", "end", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "service", "\\u", "end", "'_", "]_", "=_", "time_", "._", "strptime_", "(_", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "service", "\\u", "end", "'_", "]_", ",_", "'%", "H", ":", "%", "M", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "getp", "grp_", "(_", ")_", "!=_", "os_", "._", "tc", "getp", "grp_", "(_", "sys_", "._", "stdin_", "._", "fileno_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "config_", "[_", "'", "daemon", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "psutil_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "psutil_", "._", "cpu", "\\u", "percent_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", " ", " ", "\"", "psu", "til", "\"", " ", "module", " ", "is", " ", "not", " ", "avail", "able", ";'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", " ", " ", " ", "node", " ", "status", " ", "(", "CPU", ",", " ", "memory", ",", " ", "disk", " ", "and", " ", "swap", " ", "space", " ", "usage", ")", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "will", " ", "not", " ", "be", " ", "sent", " ", "to", " ", "clients", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disp", "y", "\\u", "node_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disp", "y", "\\u", "node_", "=_", "\\u", "Disp", "y", "Node_", "(_", "**_", "\\u", "disp", "y", "\\u", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "\\u", "disp", "y", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disp", "y", "\\u", "node_", "._", "async", "oro", "_", "._", "finish_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "disp", "y", "\\u", "provision", "al", "\\u", "result_", "(_", "result_", ",_", "timeout_", "=_", "Msg", "Timeout_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Sen", "ds", " ", "provision", "al", " ", "result", " ", "of", " ", "computation", " ", "back", " ", "to", " ", "the", " ", "client", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "In", " ", "some", " ", "case", "s", ",", " ", "suc", "h", " ", "as", " ", "optimization", "s", ",", " ", "computation", "s", " ", "may", " ", "send", "\\", "10", ";", " ", " ", " ", " ", "current", " ", "(", "best", ")", " ", "result", " ", "to", " ", "the", " ", "client", " ", "and", " ", "continue", " ", "computation", " ", "(", "for", "\\", "10", ";", " ", " ", " ", " ", "next", " ", "iterati", "on", ")", " ", "so", " ", "tha", "t", " ", "the", " ", "client", " ", "may", " ", "decide", " ", "to", " ", "terminate", "\\", "10", ";", " ", " ", " ", " ", "computation", "s", " ", "based", " ", "on", " ", "the", " ", "results", " ", "or", " ", "alter", " ", "computation", "s", " ", "if", "\\", "10", ";", " ", " ", " ", " ", "necessar", "y", ".", " ", "The", " ", "computation", "s", " ", "can", " ", "use", " ", "this", " ", "function", " ", "in", " ", "suc", "h", " ", "case", "s", "\\", "10", ";", " ", " ", " ", " ", "with", " ", "the", " ", "current", " ", "result", " ", "of", " ", "computation", " ", "as", " ", "argu", "ment", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'", "timeo", "ut", "'", " ", "is", " ", "second", "s", " ", "for", " ", "socket", " ", "connecti", "on", "/", "message", "s", ";", " ", "i", ".", "e", ".,", " ", "if", "\\", "10", ";", " ", " ", " ", " ", "there", " ", "is", " ", "no", " ", "I", "/", "O", " ", "on", " ", "socket", " ", "(", "to", " ", "client", "),", " ", "this", " ", "call", " ", "fail", "s", ".", " ", "Default", "\\", "10", ";", " ", " ", " ", " ", "value", " ", "for", " ", "it", " ", "is", " ", "Msg", "Time", "out", " ", "(", "5", ")", " ", "second", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "0", " ", "if", " ", "result", " ", "was", " ", "deliver", "ed", " ", "to", " ", "client", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "disp", "y", "\\u", "job", "\\u", "reply_", "=_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "info_", "._", "job", "\\u", "reply_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disp", "y", "\\u", "job", "\\u", "reply_", "._", "status_", "=_", "Disp", "y", "Job_", "._", "Provision", "al", "Result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disp", "y", "\\u", "job", "\\u", "reply_", "._", "result_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disp", "y", "\\u", "job", "\\u", "reply_", "._", "end", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "=_", "socket_", "._", "socket_", "(_", "socket_", "._", "AF", "\\u", "INET_", ",_", "socket_", "._", "SOCK", "\\u", "STREAM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "=_", "Async", "Socket_", "(_", "sock_", ",_", "blocking_", "=_", "True_", ",_", "keyfile_", "=_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "keyfile_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "certfile", "_", "=_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "certfile", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "._", "settimeout_", "(_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sock_", "._", "connect_", "(_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "info_", "._", "repl", "y", "\\u", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "._", "send", "\\u", "msg_", "(_", "'", "JOB", "\\u", "REPLY", ":'_", "+_", "serialize_", "(_", "disp", "y", "\\u", "job", "\\u", "reply_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ack_", "=_", "sock_", "._", "recv", "\\u", "msg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ack_", "==_", "'", "AC", "K", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Cou", "ld", "n", "'", "t", " ", "send", " ", "provision", "al", " ", "results", " ", "%", "s", ":\\\\", "n", "%", "s", "\"_", "%_", "(_", "str_", "(_", "result_", ")_", ",_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sock_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "disp", "y", "\\u", "send", "\\u", "file_", "(_", "path_", ",_", "timeout_", "=_", "Msg", "Timeout_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Computation", "s", " ", "may", " ", "use", " ", "this", " ", "function", " ", "to", " ", "send", " ", "files", " ", "back", " ", "to", " ", "the", " ", "client", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "computation", "s", " ", "have", " ", "small", " ", "amo", "unt", " ", "of", " ", "data", " ", "to", " ", "be", " ", "sent", " ", "back", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "client", ",", " ", "then", " ", "the", " ", "return", " ", "value", " ", "can", " ", "be", " ", "used", " ", "for", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "purpose", ".", " ", "Ho", "we", "ver", ",", " ", "if", " ", "(", "temporar", "y", ")", " ", "result", " ", "is", " ", "store", "d", " ", "in", " ", "file", "(", "s", "),", " ", "then", "\\", "10", ";", " ", " ", " ", " ", "tho", "se", " ", "file", "(", "s", ")", " ", "can", " ", "be", " ", "sent", " ", "back", " ", "to", " ", "the", " ", "client", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "File", " ", "at", " ", "give", "n", " ", "'", "path", "'", " ", "is", " ", "sent", " ", "to", " ", "the", " ", "client", ",", " ", "whi", "ch", " ", "save", "s", " ", "the", " ", "file", "\\", "10", ";", " ", " ", " ", " ", "with", " ", "the", " ", "same", " ", "path", " ", "under", " ", "its", " ", "working", " ", "director", "y", ".", " ", "If", " ", "multiple", " ", "jobs", "\\", "10", ";", " ", " ", " ", " ", "on", " ", "different", " ", "nodes", " ", "send", " ", "files", ",", " ", "care", " ", "must", " ", "be", " ", "take", "n", " ", "to", " ", "use", " ", "different", "\\", "10", ";", " ", " ", " ", " ", "path", "s", " ", "so", " ", "files", " ", "sent", " ", "by", " ", "one", " ", "job", " ", "don", "'", "t", " ", "overwrit", "e", " ", "files", " ", "sent", " ", "by", " ", "other", "\\", "10", ";", " ", " ", " ", " ", "jobs", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "file", " ", "size", " ", "exceed", "s", " ", "'", "Max", "File", "Size", "'", " ", "bytes", ",", " ", "this", " ", "function", " ", "return", "s", " ", "-1", ",", "\\", "10", ";", " ", " ", " ", " ", "with", "out", " ", "sendin", "g", " ", "it", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'", "timeo", "ut", "'", " ", "is", " ", "second", "s", " ", "for", " ", "socket", " ", "connecti", "on", "/", "message", "s", ";", " ", "i", ".", "e", ".,", " ", "if", "\\", "10", ";", " ", " ", " ", " ", "there", " ", "is", " ", "no", " ", "I", "/", "O", " ", "on", " ", "socket", " ", "(", "to", " ", "client", "),", " ", "this", " ", "call", " ", "fail", "s", ".", " ", "Default", "\\", "10", ";", " ", " ", " ", " ", "value", " ", "for", " ", "it", " ", "is", " ", "Msg", "Time", "out", " ", "(", "5", ")", " ", "second", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "value", " ", "of", " ", "0", " ", "indicat", "es", " ", "success", "full", " ", "transfer", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xf_", "=_", "\\u", "Xf", "er", "File_", "(_", "path_", ",_", "os_", "._", "stat_", "(_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Max", "File", "Size_", "and_", "xf_", "._", "stat", "\\u", "buf_", "._", "st", "\\u", "size_", ">_", "Max", "File", "Size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xf_", "._", "name_", "=_", "os_", "._", "path_", "._", "split", "drive_", "(_", "path_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "xf_", "._", "name_", "._", "startswith_", "(_", "os_", "._", "sep_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xf_", "._", "name_", "=_", "xf_", "._", "name_", "[_", "len_", "(_", "os_", "._", "sep_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "disp", "y", "\\u", "job", "\\u", "reply_", "=_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "info_", "._", "job", "\\u", "reply_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "=_", "socket_", "._", "socket_", "(_", "socket_", "._", "AF", "\\u", "INET_", ",_", "socket_", "._", "SOCK", "\\u", "STREAM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "=_", "Async", "Socket_", "(_", "sock_", ",_", "blocking_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keyfile_", "=_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "keyfile_", ",_", "certfile", "_", "=_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "certfile", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "._", "settimeout_", "(_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sock_", "._", "connect_", "(_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "info_", "._", "repl", "y", "\\u", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "._", "send", "\\u", "msg_", "(_", "'", "FILE", "XF", "ER", ":'_", "._", "encode_", "(_", ")_", "+_", "serialize_", "(_", "xf_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "._", "send", "\\u", "msg_", "(_", "serialize_", "(_", "disp", "y", "\\u", "job", "\\u", "reply_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recv", "d_", "=_", "sock_", "._", "recv", "\\u", "msg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recv", "d_", "=_", "unse", "rial", "ize_", "(_", "recv", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "=_", "open_", "(_", "path_", ",_", "'", "rb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sent_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "sent_", "==_", "recv", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "fd_", "._", "read_", "(_", "1024", "000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sock_", "._", "sendall_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sent_", "+=_", "len_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recv", "d_", "=_", "sock_", "._", "recv", "\\u", "msg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recv", "d_", "=_", "unse", "rial", "ize_", "(_", "recv", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fd_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "recv", "d_", "==_", "xf_", "._", "stat", "\\u", "buf_", "._", "st", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Cou", "ld", " ", "not", " ", "transfer", " ", "file", " ", "\"%", "s", "\":", " ", "%", "s", "'_", "%_", "(_", "path_", ",_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sock_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "disp", "y", "\\u", "job", "\\u", "func_", "(_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "info_", ",_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "certfile", "_", ",_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "keyfile_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "name_", ",_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "args_", ",_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "kwargs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "code_", ",_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "globals_", ",_", "\\u\\u", "disp", "y", "\\u", "path_", ",_", "\\u\\u", "disp", "y", "\\u", "repl", "y", "\\u", "Q_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Intern", "al", " ", "use", " ", "only", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "chdir_", "(_", "\\u\\u", "disp", "y", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "=_", "io_", "._", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stderr_", "=_", "io_", "._", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "reply_", "=_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "info_", "._", "job", "\\u", "reply_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "globals_", "(_", ")_", "._", "update_", "(_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "globals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exec_", "(_", "marshal_", "._", "loads_", "(_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "code_", "[_", "0_", "]_", ")_", ")_", "in_", "globals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "code_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exec_", "(_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "code_", "[_", "1_", "]_", ")_", "in_", "globals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "args_", "=_", "unse", "rial", "ize_", "(_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "kwargs_", "=_", "unse", "rial", "ize_", "(_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "globals_", "(_", ")_", "._", "update_", "(_", "locals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exec_", "(_", "'\\u", "\\u", "disp", "y", "\\u", "job", "\\u", "repl", "y", ".", "result", " ", "=", " ", "%", "s", "(*", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "args", ",", " ", "**", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "kwarg", "s", ")'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "name_", ")_", "in_", "globals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "reply_", "._", "status_", "=_", "Disp", "y", "Job_", "._", "Finished_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "reply_", "._", "exception_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "reply_", "._", "status_", "=_", "Disp", "y", "Job_", "._", "Terminate", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "reply_", "._", "stdout_", "=_", "sys_", "._", "stdout_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "reply_", "._", "stderr_", "=_", "sys_", "._", "stderr_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "reply_", "._", "end", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "info_", "._", "proc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "disp", "y", "\\u", "repl", "y", "\\u", "Q_", "._", "put_", "(_", "\\u\\u", "disp", "y", "\\u", "job", "\\u", "reply_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Disp", "y", "Node_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "cpus_", ",_", "ip", "\\u", "addr_", "=_", "None_", ",_", "ext", "\\u", "ip", "\\u", "addr_", "=_", "None_", ",_", "node", "\\u", "port_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "''_", ",_", "schedule", "r", "\\u", "node_", "=_", "None_", ",_", "schedule", "r", "\\u", "port_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest", "\\u", "path", "\\u", "prefix_", "=_", "''_", ",_", "clean_", "=_", "False_", ",_", "secret_", "=_", "''_", ",_", "keyfile_", "=_", "None_", ",_", "certfile", "_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "zombie", "\\u", "interval_", "=_", "60_", ",_", "service", "\\u", "start_", "=_", "None_", ",_", "service", "\\u", "stop_", "=_", "None_", ",_", "service", "\\u", "end_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "serve_", "=_", "-_", "1_", ",_", "daemon_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "0_", "<_", "cpus_", "<=_", "multiprocessing_", "._", "cpu", "\\u", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "num", "\\u", "cpus_", "=_", "cpus_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "socket_", "._", "gethostname_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ip", "\\u", "addr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ip", "\\u", "addr_", "=_", "\\u", "node", "\\u", "ipaddr_", "(_", "ip", "\\u", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "ip", "\\u", "addr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "invalid", " ", "ip", "\\u", "addr", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ip", "\\u", "addr_", "=_", "socket_", "._", "gethostbyname", "_", "(_", "socket_", "._", "gethostname_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ip", "\\u", "addr_", "._", "startswith_", "(_", "'", "127", ".'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "warning_", "(_", "'", "node", " ", "IP", " ", "address", " ", "%", "s", " ", "see", "ms", " ", "to", " ", "be", " ", "loopback", " ", "address", ";", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "this", " ", "will", " ", "prevent", " ", "communication", " ", "with", " ", "clients", " ", "on", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "other", " ", "machine", "s", ".", " ", "'_", ",_", "ip", "\\u", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ext", "\\u", "ip", "\\u", "addr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ext", "\\u", "ip", "\\u", "addr_", "=_", "\\u", "node", "\\u", "ipaddr_", "(_", "ext", "\\u", "ip", "\\u", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "ext", "\\u", "ip", "\\u", "addr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "invalid", " ", "ext", "\\u", "ip", "\\u", "addr", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ext", "\\u", "ip", "\\u", "addr_", "=_", "ip", "\\u", "addr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "socket_", "._", "geth", "ost", "by", "addr_", "(_", "ext", "\\u", "ip", "\\u", "addr_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "node", "\\u", "port_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node", "\\u", "port_", "=_", "513", "48_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "ext", "\\u", "ip", "\\u", "addr_", "=_", "ext", "\\u", "ip", "\\u", "addr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pulse", "\\u", "interval_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "keyfile_", "=_", "keyfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "certfile", "_", "=_", "certfile", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "keyfile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "keyfile_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "self_", "._", "keyfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "certfile", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "certfile", "_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "self_", "._", "certfile", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "async", "oro", "_", "=_", "As", "yn", "Cor", "o_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "tcp", "\\u", "sock_", "=_", "Async", "Socket_", "(_", "socket_", "._", "socket_", "(_", "socket_", "._", "AF", "\\u", "INET_", ",_", "socket_", "._", "SOCK", "\\u", "STREAM_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keyfile_", "=_", "keyfile_", ",_", "certfile", "_", "=_", "certfile", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tcp", "\\u", "sock_", "._", "setsockopt_", "(_", "socket_", "._", "SOL", "\\u", "SOCKET_", ",_", "socket_", "._", "SO", "\\u", "REUSE", "ADDR_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tcp", "\\u", "sock_", "._", "bind_", "(_", "(_", "ip", "\\u", "addr_", ",_", "node", "\\u", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "address_", "=_", "self_", "._", "tcp", "\\u", "sock_", "._", "getsockname", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "port_", "=_", "self_", "._", "address_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tcp", "\\u", "sock_", "._", "listen_", "(_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "dest", "\\u", "path", "\\u", "prefix_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dest", "\\u", "path", "\\u", "prefix_", "=_", "os_", "._", "path_", "._", "join_", "(_", "tempfile_", "._", "gettempdir_", "(_", ")_", ",_", "'", "disp", "y", "'_", ",_", "'", "node", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "dest", "\\u", "path", "\\u", "prefix_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "dest", "\\u", "path", "\\u", "prefix_", "._", "strip_", "(_", ")_", ")_", "._", "rstrip_", "(_", "os_", "._", "sep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "clean_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "rmtree_", "(_", "self_", "._", "dest", "\\u", "path", "\\u", "prefix_", ",_", "ignore", "\\u", "errors_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "self_", "._", "dest", "\\u", "path", "\\u", "prefix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "self_", "._", "dest", "\\u", "path", "\\u", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chmod_", "(_", "self_", "._", "dest", "\\u", "path", "\\u", "prefix_", ",_", "stat_", "._", "S", "\\u", "IR", "USR", "_", "|_", "stat_", "._", "S", "\\u", "IW", "USR", "_", "|_", "stat_", "._", "S", "\\u", "IX", "USR", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "avail", "\\u", "cpus_", "=_", "self_", "._", "num", "\\u", "cpus_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "computation", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "job", "\\u", "infos_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "terminate_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sign_", "=_", "os_", "._", "urandom_", "(_", "10_", ")_", "._", "encode_", "(_", "'", "hex", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "secret_", "=_", "secret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "auth_", "=_", "auth", "\\u", "code_", "(_", "self_", "._", "secret_", ",_", "self_", "._", "sign_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "zombie", "\\u", "interval_", "=_", "60_", "*_", "zombie", "\\u", "interval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "schedule", "r", "\\u", "port_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "schedule", "r", "\\u", "port_", "=_", "513", "47_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "scheduler_", "=_", "{_", "'", "ip", "\\u", "addr", "'_", ":_", "None_", ",_", "'", "port", "'_", ":_", "schedule", "r", "\\u", "port_", ",_", "'", "auth", "'_", ":_", "set_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cpu", "\\u", "time_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "num", "\\u", "jobs_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "num", "\\u", "computation", "s_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fd_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "dest", "\\u", "path", "\\u", "prefix_", ",_", "'", "config", "'_", ")_", ",_", "'", "wb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ext", "\\u", "ip", "\\u", "addr", "'_", ":_", "self_", "._", "ext", "\\u", "ip", "\\u", "addr_", ",_", "'", "port", "'_", ":_", "self_", "._", "port_", ",_", "'", "avail", "\\u", "cpus", "'_", ":_", "self_", "._", "avail", "\\u", "cpus_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sign", "'_", ":_", "self_", "._", "sign_", ",_", "'", "secret", "'_", ":_", "self_", "._", "secret_", ",_", "'", "auth", "'_", ":_", "self_", "._", "auth_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pickle_", "._", "dump_", "(_", "config_", ",_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "prepend", " ", "current", " ", "director", "y", " ", "in", " ", "sys", ".", "path", " ", "so", " ", "computation", "s", " ", "can_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "load", " ", "module", "s", " ", "from", " ", "current", " ", "working", " ", "directory_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "start", " ", "a", " ", "process", " ", "so", " ", "all", " ", "module", "s", " ", "need", "ed", " ", "by", " ", "disp", "yn", "ode", " ", "are", " ", "loaded_", "\\u\\u\\uNL\\u\\u\\u_", "proc_", "=_", "multiprocessing_", "._", "Process_", "(_", "target_", "=_", "functools_", "._", "partial_", "(_", "int_", ")_", ",_", "args_", "=_", "(_", "42_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "._", "join_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "thread", "\\u", "lock_", "=_", "threading_", "._", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ud", "p", "\\u", "sock_", "=_", "socket_", "._", "socket_", "(_", "socket_", "._", "AF", "\\u", "INET_", ",_", "socket_", "._", "SOCK", "\\u", "DGRAM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ud", "p", "\\u", "sock_", "._", "setsockopt_", "(_", "socket_", "._", "SOL", "\\u", "SOCKET_", ",_", "socket_", "._", "SO", "\\u", "REUSE", "ADDR_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ud", "p", "\\u", "sock_", "._", "bind_", "(_", "(_", "''_", ",_", "self_", "._", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disp", "y", "\\u", "logger_", "._", "info_", "(_", "'", "serving", " ", "%", "s", " ", "cpus", " ", "at", " ", "%", "s", ":", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "num", "\\u", "cpus_", ",_", "self_", "._", "ext", "\\u", "ip", "\\u", "addr_", ",_", "self_", "._", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "'", "tcp", " ", "server", " ", "at", " ", "%", "s", ":", "%", "s", "'_", ",_", "self_", "._", "address_", "[_", "0_", "]_", ",_", "self_", "._", "address_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ud", "p", "\\u", "sock_", "=_", "Async", "Socket_", "(_", "self_", "._", "ud", "p", "\\u", "sock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "repl", "y", "\\u", "Q_", "=_", "multiprocessing_", "._", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "repl", "y", "\\u", "Q", "\\u", "thread_", "=_", "threading_", "._", "Thread_", "(_", "target_", "=_", "self_", "._", "\\u\\u", "repl", "y", "\\u", "Q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "repl", "y", "\\u", "Q", "\\u", "thread_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "serve_", "=_", "serve_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timer", "\\u", "coro_", "=_", "Cor", "o_", "(_", "self_", "._", "timer", "\\u", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "service", "\\u", "start_", "=_", "self_", "._", "service", "\\u", "stop_", "=_", "self_", "._", "service", "\\u", "end_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "service", "\\u", "start_", ",_", "time_", "._", "struct", "\\u", "time_", ")_", "and_", "(_", "isinstance_", "(_", "service", "\\u", "stop_", ",_", "time_", "._", "struct", "\\u", "time_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "isinstance_", "(_", "service", "\\u", "end_", ",_", "time_", "._", "struct", "\\u", "time_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "service", "\\u", "start_", "=_", "(_", "service", "\\u", "start_", "._", "tm", "\\u", "hour_", ",_", "service", "\\u", "start_", "._", "tm", "\\u", "min_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "service", "\\u", "stop_", ",_", "time_", "._", "struct", "\\u", "time_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "service", "\\u", "stop_", "=_", "(_", "service", "\\u", "stop_", "._", "tm", "\\u", "hour_", ",_", "service", "\\u", "stop_", "._", "tm", "\\u", "min_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "service", "\\u", "end_", ",_", "time_", "._", "struct", "\\u", "time_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "service", "\\u", "end_", "=_", "(_", "service", "\\u", "end_", "._", "tm", "\\u", "hour_", ",_", "service", "\\u", "end_", "._", "tm", "\\u", "min_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Cor", "o_", "(_", "self_", "._", "service", "\\u", "schedule_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u\\u", "init", "\\u", "code_", "=_", "''_", "._", "join_", "(_", "inspect_", "._", "gets", "ource_", "(_", "disp", "y", "\\u", "provision", "al", "\\u", "result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "init", "\\u", "code_", "+=_", "''_", "._", "join_", "(_", "inspect_", "._", "gets", "ource_", "(_", "disp", "y", "\\u", "send", "\\u", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "init", "\\u", "modules_", "=_", "dict_", "(_", "sys_", "._", "modules_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "name_", "==_", "'", "nt", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "init", "\\u", "globals_", "=_", "dict_", "(_", "globals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "tcp", "\\u", "coro_", "=_", "Cor", "o_", "(_", "self_", "._", "tcp", "\\u", "server_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ud", "p", "\\u", "coro_", "=_", "Cor", "o_", "(_", "self_", "._", "ud", "p", "\\u", "server_", ",_", "\\u", "node", "\\u", "ipaddr_", "(_", "schedule", "r", "\\u", "node_", ")_", ",_", "schedule", "r", "\\u", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "daemon_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Cor", "o_", "(_", "self_", "._", "read", "\\u", "stdin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Disp", "y", "Node_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "broadcast", "\\u", "ping", "\\u", "msg_", "(_", "self_", ",_", "coro_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "scheduler_", "[_", "'", "ip", "\\u", "addr", "'_", "]_", "or_", "self_", "._", "job", "\\u", "infos_", "or_", "not_", "self_", "._", "avail", "\\u", "cpus_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "self_", "._", "service", "\\u", "available_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sock_", "=_", "socket_", "._", "socket_", "(_", "socket_", "._", "AF", "\\u", "INET_", ",_", "socket_", "._", "SOCK", "\\u", "DGRAM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "._", "setsockopt_", "(_", "socket_", "._", "SOL", "\\u", "SOCKET_", ",_", "socket_", "._", "SO", "\\u", "BROADCAST", "_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "=_", "Async", "Socket_", "(_", "sock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "._", "settimeout_", "(_", "Msg", "Timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ping", "\\u", "msg_", "=_", "{_", "'", "ip", "\\u", "addr", "'_", ":_", "self_", "._", "ext", "\\u", "ip", "\\u", "addr_", ",_", "'", "port", "'_", ":_", "self_", "._", "port_", ",_", "'", "sign", "'_", ":_", "self_", "._", "sign_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "'_", ":_", "\\u", "disp", "y", "\\u", "version_", ",_", "'", "schedule", "r", "\\u", "ip", "\\u", "addr", "'_", ":_", "None_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "sock_", "._", "sendto_", "(_", "'", "PING", ":'_", "._", "encode_", "(_", ")_", "+_", "serialize_", "(_", "ping", "\\u", "msg_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'<", "broadcast", ">'_", ",_", "self_", "._", "scheduler_", "[_", "'", "port", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sock_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Disp", "y", "Node_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "\\u", "pong", "\\u", "msg_", "(_", "self_", ",_", "info_", ",_", "addr_", ",_", "coro_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "scheduler_", "[_", "'", "ip", "\\u", "addr", "'_", "]_", "or_", "self_", "._", "job", "\\u", "infos_", "or_", "not_", "self_", "._", "num", "\\u", "cpus_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "self_", "._", "service", "\\u", "available_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "'", "Busy", " ", "(%", "s", "/", "%", "s", ");", " ", "ign", "orin", "g", " ", "ping", " ", "message", " ", "from", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "avail", "\\u", "cpus_", ",_", "self_", "._", "num", "\\u", "cpus_", ",_", "addr_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "schedule", "r", "\\u", "ip", "\\u", "addrs_", "=_", "info_", "[_", "'", "ip", "\\u", "addr", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "info_", "._", "get_", "(_", "'", "relay", "'_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "schedule", "r", "\\u", "ip", "\\u", "addrs_", "._", "append_", "(_", "addr_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "schedule", "r", "\\u", "port_", "=_", "info_", "[_", "'", "port", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "info_", "._", "get_", "(_", "'", "sign", "'_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pong", "\\u", "msg_", "=_", "{_", "'", "ip", "\\u", "addr", "'_", ":_", "self_", "._", "ext", "\\u", "ip", "\\u", "addr_", ",_", "'", "port", "'_", ":_", "self_", "._", "port_", ",_", "'", "sign", "'_", ":_", "self_", "._", "sign_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "'_", ":_", "\\u", "disp", "y", "\\u", "version_", ",_", "'", "name", "'_", ":_", "self_", "._", "name_", ",_", "'", "cpus", "'_", ":_", "self_", "._", "avail", "\\u", "cpus_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", "'_", ":_", "auth", "\\u", "code_", "(_", "self_", "._", "secret_", ",_", "info_", "[_", "'", "sign", "'_", "]_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "psutil_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pong", "\\u", "msg_", "[_", "'", "avail", "\\u", "info", "'_", "]_", "=_", "Disp", "y", "Node", "Avail", "Info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "100.0_", "-_", "psutil_", "._", "cpu", "\\u", "percent_", "(_", ")_", ",_", "psutil_", "._", "virtual", "\\u", "memory_", "(_", ")_", "._", "available_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "psutil_", "._", "disk", "\\u", "usage_", "(_", "self_", "._", "dest", "\\u", "path", "\\u", "prefix_", ")_", "._", "free_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "100.0_", "-_", "psutil_", "._", "swap", "\\u", "memory_", "(_", ")_", "._", "percent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pong", "\\u", "msg_", "[_", "'", "avail", "\\u", "info", "'_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "schedule", "r", "\\u", "ip", "\\u", "addr_", "in_", "schedule", "r", "\\u", "ip", "\\u", "addrs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addr_", "=_", "(_", "schedule", "r", "\\u", "ip", "\\u", "addr_", ",_", "schedule", "r", "\\u", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pong", "\\u", "msg_", "[_", "'", "schedule", "r", "\\u", "ip", "\\u", "addr", "'_", "]_", "=_", "schedule", "r", "\\u", "ip", "\\u", "addr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "=_", "Async", "Socket_", "(_", "socket_", "._", "socket_", "(_", "socket_", "._", "AF", "\\u", "INET_", ",_", "socket_", "._", "SOCK", "\\u", "STREAM_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keyfile_", "=_", "self_", "._", "keyfile_", ",_", "certfile", "_", "=_", "self_", "._", "certfile", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "._", "settimeout_", "(_", "Msg", "Timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "yield_", "sock_", "._", "connect_", "(_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "sock_", "._", "send", "\\u", "msg_", "(_", "'", "PON", "G", ":'_", "._", "encode_", "(_", ")_", "+_", "serialize_", "(_", "pong", "\\u", "msg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "'", "Cou", "ld", " ", "not", " ", "connect", " ", "to", " ", "%", "s", ":", "%", "s", "'_", ",_", "addr_", "[_", "0_", "]_", ",_", "addr_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sock_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sock_", "=_", "Async", "Socket_", "(_", "socket_", "._", "socket_", "(_", "socket_", "._", "AF", "\\u", "INET_", ",_", "socket_", "._", "SOCK", "\\u", "DGRAM_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "._", "settimeout_", "(_", "Msg", "Timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ping", "\\u", "msg_", "=_", "{_", "'", "ip", "\\u", "addr", "'_", ":_", "self_", "._", "ext", "\\u", "ip", "\\u", "addr_", ",_", "'", "port", "'_", ":_", "self_", "._", "port_", ",_", "'", "sign", "'_", ":_", "self_", "._", "sign_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "'_", ":_", "\\u", "disp", "y", "\\u", "version_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "schedule", "r", "\\u", "ip", "\\u", "addr_", "in_", "schedule", "r", "\\u", "ip", "\\u", "addrs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addr_", "=_", "(_", "schedule", "r", "\\u", "ip", "\\u", "addr_", ",_", "schedule", "r", "\\u", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ping", "\\u", "msg_", "[_", "'", "schedule", "r", "\\u", "ip", "\\u", "addr", "'_", "]_", "=_", "schedule", "r", "\\u", "ip", "\\u", "addr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "yield_", "sock_", "._", "sendto_", "(_", "'", "PING", ":'_", "._", "encode_", "(_", ")_", "+_", "serialize_", "(_", "ping", "\\u", "msg_", ")_", ",_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sock_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Disp", "y", "Node_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ud", "p", "\\u", "server_", "(_", "self_", ",_", "schedule", "r", "\\u", "ip_", ",_", "schedule", "r", "\\u", "port_", ",_", "coro_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coro_", "._", "set\\u", "daemon_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "broadcast", "\\u", "ping", "\\u", "msg_", "(_", "coro_", "=_", "coro_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ping", "\\u", "msg_", "=_", "{_", "'", "ip", "\\u", "addr", "'_", ":_", "self_", "._", "ext", "\\u", "ip", "\\u", "addr_", ",_", "'", "port", "'_", ":_", "self_", "._", "port_", ",_", "'", "sign", "'_", ":_", "self_", "._", "sign_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "'_", ":_", "\\u", "disp", "y", "\\u", "version_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "send", "\\u", "ping", "\\u", "msg_", "(_", "self_", ",_", "info_", ",_", "coro_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sock_", "=_", "Async", "Socket_", "(_", "socket_", "._", "socket_", "(_", "socket_", "._", "AF", "\\u", "INET_", ",_", "socket_", "._", "SOCK", "\\u", "DGRAM_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "._", "settimeout_", "(_", "Msg", "Timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addr_", "=_", "(_", "info_", "[_", "'", "ip", "\\u", "addr", "'_", "]_", ",_", "info_", "[_", "'", "port", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "._", "update_", "(_", "ping", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "[_", "'", "schedule", "r", "\\u", "ip", "\\u", "addr", "'_", "]_", "=_", "addr_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "sock_", "._", "sendto_", "(_", "'", "PING", ":'_", "._", "encode_", "(_", ")_", "+_", "serialize_", "(_", "info_", ")_", ",_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sock_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sock_", "=_", "Async", "Socket_", "(_", "socket_", "._", "socket_", "(_", "socket_", "._", "AF", "\\u", "INET_", ",_", "socket_", "._", "SOCK", "\\u", "STREAM_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keyfile_", "=_", "self_", "._", "keyfile_", ",_", "certfile", "_", "=_", "self_", "._", "certfile", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "._", "settimeout_", "(_", "Msg", "Timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "sock_", "._", "connect_", "(_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "sock_", "._", "send", "\\u", "msg_", "(_", "'", "PING", ":'_", "._", "encode_", "(_", ")_", "+_", "serialize_", "(_", "info_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sock_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "schedule", "r", "\\u", "ip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Cor", "o_", "(_", "send", "\\u", "ping", "\\u", "msg_", ",_", "self_", ",_", "{_", "'", "ip", "\\u", "addr", "'_", ":_", "schedule", "r", "\\u", "ip_", ",_", "'", "port", "'_", ":_", "schedule", "r", "\\u", "port_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", ",_", "addr_", "=_", "yield_", "self_", "._", "ud", "p", "\\u", "sock_", "._", "recv", "from_", "(_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "process", " ", "each", " ", "message", " ", "as", " ", "separate", " ", "Cor", "o", ",", " ", "so_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exception", "s", " ", "are", " ", "contain", "ed", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "msg_", "._", "startswith_", "(_", "'", "PING", ":'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "info_", "=_", "unse", "rial", "ize_", "(_", "msg_", "[_", "len_", "(_", "'", "PING", ":'_", ")_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "info_", "[_", "'", "version", "'_", "]_", "!=_", "\\u", "disp", "y", "\\u", "version_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "warning_", "(_", "'", "Ignor", "ing", " ", "%", "s", " ", "due", " ", "to", " ", "version", " ", "mism", "atch", "'_", ",_", "addr_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "'", "Ignor", "ing", " ", "ping", " ", "message", " ", "from", " ", "%", "s", " ", "(%", "s", ")'_", ",_", "addr_", "[_", "0_", "]_", ",_", "addr_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Cor", "o_", "(_", "self_", "._", "send", "\\u", "pong", "\\u", "msg_", ",_", "info_", ",_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "msg_", "._", "startswith_", "(_", "'", "PUL", "SE", ":'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "info_", "=_", "unse", "rial", "ize_", "(_", "msg_", "[_", "len_", "(_", "'", "PUL", "SE", ":'_", ")_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "disp", "y", "\\u", "logger_", "._", "warning_", "(_", "'", "Ignor", "ing", " ", "PUL", "SE", " ", "from", " ", "%", "s", "'_", ",_", "addr_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "info_", "[_", "'", "ip", "\\u", "addr", "'_", "]_", "==_", "self_", "._", "scheduler_", "[_", "'", "ip", "\\u", "addr", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "now_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "compute_", "in_", "self_", "._", "computation", "s_", "._", "itervalues_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "compute_", "._", "last", "\\u", "pulse_", "=_", "now_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "warning_", "(_", "'", "Ignor", "ing", " ", "ping", " ", "message", " ", "from", " ", "%", "s", "'_", ",_", "addr_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Disp", "y", "Node_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tcp", "\\u", "server_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", ",_", "addr_", "=_", "yield_", "self_", "._", "tcp", "\\u", "sock_", "._", "accept_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Generat", "or", "Exit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Cor", "o_", "(_", "self_", "._", "tcp", "\\u", "serve", "\\u", "task_", ",_", "conn_", ",_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Disp", "y", "Node_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tcp", "\\u", "serve", "\\u", "task_", "(_", "self_", ",_", "conn_", ",_", "addr_", ",_", "coro_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "job", "\\u", "request", "\\u", "task_", "(_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "job_", "=_", "unse", "rial", "ize_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "'", "Ignor", "ing", " ", "job", " ", "request", " ", "from", " ", "%", "s", "'_", ",_", "addr_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "\\u", "disp", "y", "\\u", "logg", "er", ".", "debug", "(", "traceback", ".", "format\\u", "exc", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "compute_", "=_", "self_", "._", "computation", "s_", "._", "get_", "(_", "\\u", "job_", "._", "compute", "\\u", "id_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "compute_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "compute_", "._", "schedule", "r", "\\u", "ip", "\\u", "addr_", "!=_", "self_", "._", "scheduler_", "[_", "'", "ip", "\\u", "addr", "'_", "]_", "or_", "compute_", "._", "schedule", "r", "\\u", "port_", "!=_", "self_", "._", "scheduler_", "[_", "'", "port", "'_", "]_", "or_", "compute_", "._", "auth_", "not_", "in_", "self_", "._", "scheduler_", "[_", "'", "auth", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "'", "Inva", "lid", " ", "schedule", "r", " ", "IP", " ", "address", ":", " ", "schedule", "r", " ", "%", "s", ":", "%", "s", " ", "!=", " ", "%", "s", ":", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "compute_", "._", "schedule", "r", "\\u", "ip", "\\u", "addr_", ",_", "compute_", "._", "schedule", "r", "\\u", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "scheduler_", "[_", "'", "ip", "\\u", "addr", "'_", "]_", ",_", "self_", "._", "scheduler_", "[_", "'", "port", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "avail", "\\u", "cpus_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "yield_", "conn_", "._", "send", "\\u", "msg_", "(_", "'", "NA", "K", " ", "(", "all", " ", "cpus", " ", "bus", "y", ")'_", "._", "encode_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "compute_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "warning_", "(_", "'", "Inva", "lid", " ", "computation", " ", "%", "s", "'_", ",_", "\\u", "job_", "._", "compute", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "yield_", "conn_", "._", "send", "\\u", "msg_", "(_", "(_", "'", "NA", "K", " ", "(", "invalid", " ", "computation", " ", "%", "s", ")'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "job_", "._", "compute", "\\u", "id_", ")_", "._", "encode_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "xf_", "in_", "\\u", "job_", "._", "xfer", "\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "Max", "File", "Size_", "and_", "xf_", "._", "stat", "\\u", "buf_", "._", "st", "\\u", "size_", ">_", "Max", "File", "Size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "yield_", "conn_", "._", "send", "\\u", "msg_", "(_", "'", "NA", "K", "'_", "._", "encode_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "repl", "y", "\\u", "addr_", "=_", "(_", "compute_", "._", "schedule", "r", "\\u", "ip", "\\u", "addr_", ",_", "compute_", "._", "job", "\\u", "result", "\\u", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "'", "New", " ", "job", " ", "id", " ", "%", "s", " ", "from", " ", "%", "s", "/", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "job_", "._", "uid_", ",_", "addr_", "[_", "0_", "]_", ",_", "compute_", "._", "schedule", "r", "\\u", "ip", "\\u", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "compute_", "._", "type_", "==_", "\\u", "Compute", "_", "._", "func", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reply_", "=_", "\\u", "Jo", "b", "Reply_", "(_", "\\u", "job_", ",_", "self_", "._", "ext", "\\u", "ip", "\\u", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reply_", "._", "start", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "info_", "=_", "\\u", "Disp", "y", "Jo", "b", "Info_", "(_", "reply_", ",_", "repl", "y", "\\u", "addr_", ",_", "compute_", ",_", "\\u", "job_", "._", "xfer", "\\u", "files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "(_", "job", "\\u", "info_", ",_", "self_", "._", "certfile", "_", ",_", "self_", "._", "keyfile_", ",_", "compute_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "job_", "._", "args_", ",_", "\\u", "job_", "._", "kwargs_", ",_", "(_", "compute_", "._", "code_", ",_", "\\u", "job_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "compute_", "._", "globals_", ",_", "compute_", "._", "dest", "\\u", "path_", ",_", "self_", "._", "repl", "y", "\\u", "Q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "yield_", "conn_", "._", "send", "\\u", "msg_", "(_", "'", "AC", "K", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "disp", "y", "\\u", "logger_", "._", "warning_", "(_", "'", "Fail", "ed", " ", "to", " ", "send", " ", "response", " ", "for", " ", "new", " ", "job", " ", "to", " ", "%", "s", "'_", ",_", "str_", "(_", "addr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "proc_", "=_", "multiprocessing_", "._", "Process_", "(_", "target_", "=_", "\\u", "disp", "y", "\\u", "job", "\\u", "func_", ",_", "args_", "=_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "avail", "\\u", "cpus_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute_", "._", "pend", "ing", "\\u", "jobs_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "thread", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "job", "\\u", "infos_", "[_", "\\u", "job_", "._", "uid_", "]_", "=_", "job", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "thread", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "proc_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "job", "\\u", "info_", "._", "job", "\\u", "reply_", "._", "status_", "=_", "Disp", "y", "Job_", "._", "Terminate", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "info_", "._", "job", "\\u", "reply_", "._", "exception_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "info_", "._", "job", "\\u", "reply_", "._", "end", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "info_", "._", "proc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "repl", "y", "\\u", "Q_", "._", "put_", "(_", "job", "\\u", "info_", "._", "job", "\\u", "reply_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "job", "\\u", "info_", "._", "proc_", "=_", "proc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "info_", "._", "job", "\\u", "reply_", "._", "status_", "=_", "Disp", "y", "Job_", "._", "Running_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "compute_", "._", "type_", "==_", "\\u", "Compute", "_", "._", "prog", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "yield_", "conn_", "._", "send", "\\u", "msg_", "(_", "'", "AC", "K", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "disp", "y", "\\u", "logger_", "._", "warning_", "(_", "'", "Fail", "ed", " ", "to", " ", "send", " ", "response", " ", "for", " ", "new", " ", "job", " ", "to", " ", "%", "s", "'_", ",_", "str_", "(_", "addr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "reply_", "=_", "\\u", "Jo", "b", "Reply_", "(_", "\\u", "job_", ",_", "self_", "._", "ext", "\\u", "ip", "\\u", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reply_", "._", "start", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "info_", "=_", "\\u", "Disp", "y", "Jo", "b", "Info_", "(_", "reply_", ",_", "repl", "y", "\\u", "addr_", ",_", "compute_", ",_", "\\u", "job_", "._", "xfer", "\\u", "files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "info_", "._", "job", "\\u", "reply_", "._", "status_", "=_", "Disp", "y", "Job_", "._", "Running_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "thread", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "job", "\\u", "infos_", "[_", "\\u", "job_", "._", "uid_", "]_", "=_", "job", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "thread", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "avail", "\\u", "cpus_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute_", "._", "pend", "ing", "\\u", "jobs_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prog", "\\u", "thread_", "=_", "threading_", "._", "Thread_", "(_", "target_", "=_", "self_", "._", "\\u\\u", "job", "\\u", "program_", ",_", "args_", "=_", "(_", "\\u", "job_", ",_", "job", "\\u", "info_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prog", "\\u", "thread_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "yield_", "conn_", "._", "send", "\\u", "msg_", "(_", "(_", "'", "NA", "K", " ", "(", "invalid", " ", "computation", " ", "type", " ", "\"%", "s", "\")'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "compute_", "._", "type_", ")_", "._", "encode_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "disp", "y", "\\u", "logger_", "._", "warning_", "(_", "'", "Fail", "ed", " ", "to", " ", "send", " ", "response", " ", "for", " ", "new", " ", "job", " ", "to", " ", "%", "s", "'_", ",_", "str_", "(_", "addr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "computation", "\\u", "task_", "(_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "compute_", "=_", "unse", "rial", "ize_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "yield_", "conn_", "._", "send", "\\u", "msg_", "(_", "(_", "'", "Inva", "lid", " ", "computation", " ", "request", " ", "ignore", "d", "'_", ")_", "._", "encode_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "(_", "(_", "self_", "._", "scheduler_", "[_", "'", "ip", "\\u", "addr", "'_", "]_", "is_", "None_", "and_", "not_", "self_", "._", "scheduler_", "[_", "'", "auth", "'_", "]_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "scheduler_", "[_", "'", "ip", "\\u", "addr", "'_", "]_", "==_", "compute_", "._", "schedule", "r", "\\u", "ip", "\\u", "addr_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "scheduler_", "[_", "'", "port", "'_", "]_", "==_", "compute_", "._", "schedule", "r", "\\u", "port_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "service", "\\u", "available_", "(_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "'", "Ignor", "ing", " ", "computation", " ", "request", " ", "from", " ", "%", "s", ":", " ", "%", "s", ",", " ", "%", "s", ",", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "compute_", "._", "schedule", "r", "\\u", "ip", "\\u", "addr_", ",_", "self_", "._", "scheduler_", "[_", "'", "ip", "\\u", "addr", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "avail", "\\u", "cpus_", ",_", "self_", "._", "num", "\\u", "cpus_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "yield_", "conn_", "._", "send", "\\u", "msg_", "(_", "(_", "'", "Node", " ", "bus", "y", "'_", ")_", "._", "encode_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Max", "File", "Size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "xf_", "in_", "compute_", "._", "xfer", "\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "xf_", "._", "stat", "\\u", "buf_", "._", "st", "\\u", "size_", ">_", "Max", "File", "Size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "yield_", "conn_", "._", "send", "\\u", "msg_", "(_", "(_", "'", "File", " ", "\"%", "s", "\"", " ", "is", " ", "too", " ", "big", ";", " ", "limit", " ", "is", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "xf_", "._", "name_", ",_", "Max", "File", "Size_", ")_", ")_", "._", "encode_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "compute_", "._", "xfer", "\\u", "files_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "dest", "\\u", "path", "\\u", "prefix_", ",_", "compute_", "._", "schedule", "r", "\\u", "ip", "\\u", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "dest_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "os_", "._", "mkdir_", "(_", "dest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "yield_", "conn_", "._", "send", "\\u", "msg_", "(_", "(_", "'", "Cou", "ld", " ", "not", " ", "create", " ", "destinat", "ion", " ", "path", "'_", ")_", "._", "encode_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "compute_", "._", "dest", "\\u", "path_", "and_", "isinstance_", "(_", "compute_", "._", "dest", "\\u", "path_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "get", " ", "os", ".", "sep", " ", "from", " ", "client", " ", "and", " ", "convert", " ", "(", "in", " ", "case", " ", "of", " ", "mixed", " ", "environ", "ment", "s", ")?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "compute_", "._", "dest", "\\u", "path_", "._", "startswith_", "(_", "os_", "._", "sep_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "compute_", "._", "dest", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "dest_", ",_", "compute_", "._", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "compute_", "._", "dest", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "os_", "._", "makedirs_", "(_", "compute_", "._", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "yield_", "conn_", "._", "send", "\\u", "msg_", "(_", "(_", "'", "Cou", "ld", " ", "not", " ", "create", " ", "destinat", "ion", " ", "path", "'_", ")_", "._", "encode_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "compute_", "._", "dest", "\\u", "path_", "=_", "tempfile_", "._", "mkdtemp_", "(_", "prefix_", "=_", "compute_", "._", "name_", "+_", "'\\u'_", ",_", "dir_", "=_", "dest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "chmod_", "(_", "compute_", "._", "dest", "\\u", "path_", ",_", "stat_", "._", "S", "\\u", "IR", "USR", "_", "|_", "stat_", "._", "S", "\\u", "IW", "USR", "_", "|_", "stat_", "._", "S", "\\u", "IX", "USR", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "compute_", "._", "id_", "in_", "self_", "._", "computation", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "warning_", "(_", "'", "Computation", " ", "\"%", "s", "\"", " ", "(%", "s", ")", " ", "is", " ", "bei", "ng", " ", "replaced", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "compute_", "._", "name_", ",_", "compute_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setattr_", "(_", "compute_", ",_", "'", "last", "\\u", "pulse", "'_", ",_", "time_", "._", "time_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "compute_", ",_", "'", "pend", "ing", "\\u", "jobs", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "compute_", ",_", "'", "pend", "ing", "\\u", "results", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "compute_", ",_", "'", "zombie", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "compute_", ",_", "'", "globals", "'_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "compute_", ",_", "'", "ante", "\\u", "module", "s", "'_", ",_", "set_", "(_", "sys_", "._", "modules_", "._", "iterkeys_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "compute_", ",_", "'", "file", "\\u", "use", "s", "'_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "compute_", "._", "code_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "code_", "=_", "compute_", "._", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "+=_", "self_", "._", "\\u\\u", "init", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "compile_", "(_", "code_", ",_", "'<", "string", ">'_", ",_", "'", "exec", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "compute_", "._", "dest", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "os_", "._", "rmdir_", "(_", "compute_", "._", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "yield_", "conn_", "._", "send", "\\u", "msg_", "(_", "(_", "'%", "s", ":", " ", "Computation", " ", "\"%", "s", "\"", " ", "coul", "d", " ", "not", " ", "be", " ", "compile", "d", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "ext", "\\u", "ip", "\\u", "addr_", ",_", "compute_", "._", "name_", ")_", ")_", "._", "encode_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "compute_", "._", "code_", "=_", "marshal_", "._", "dumps_", "(_", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "compute_", "._", "type_", "==_", "\\u", "Compute", "_", "._", "prog", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "compute_", "._", "name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "compute_", "._", "dest", "\\u", "path_", ",_", "os_", "._", "path_", "._", "basename_", "(_", "compute_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "(_", "(_", "self_", "._", "scheduler_", "[_", "'", "ip", "\\u", "addr", "'_", "]_", "is_", "None_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "scheduler_", "[_", "'", "ip", "\\u", "addr", "'_", "]_", "==_", "compute_", "._", "schedule", "r", "\\u", "ip", "\\u", "addr_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "scheduler_", "[_", "'", "port", "'_", "]_", "==_", "compute_", "._", "schedule", "r", "\\u", "port_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "compute_", "._", "dest", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "os_", "._", "rmdir_", "(_", "compute_", "._", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "conn_", "._", "send", "\\u", "msg_", "(_", "serialize_", "(_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "computation", "s_", "[_", "compute_", "._", "id_", "]_", "=_", "compute_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "scheduler_", "[_", "'", "ip", "\\u", "addr", "'_", "]_", "=_", "compute_", "._", "schedule", "r", "\\u", "ip", "\\u", "addr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "scheduler_", "[_", "'", "port", "'_", "]_", "=_", "compute_", "._", "schedule", "r", "\\u", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "scheduler_", "[_", "'", "auth", "'_", "]_", "._", "add_", "(_", "compute_", "._", "auth_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute", "\\u", "save_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "dest", "\\u", "path", "\\u", "prefix_", ",_", "'%", "s", "\\u", "%", "s", "'_", "%_", "(_", "compute_", "._", "id_", ",_", "compute_", "._", "auth_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "=_", "open_", "(_", "compute", "\\u", "save_", ",_", "'", "wb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pickle_", "._", "dump_", "(_", "compute_", ",_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "variab", "les", " ", "need", "ed", " ", "for", " ", "'", "disp", "y", "\\u", "provision", "al", "\\u", "result", "'", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "disp", "y", "\\u", "send", "\\u", "file", "'", " ", "to", " ", "compute", ".", "globals", ";", " ", "but", " ", "in", " ", "Windows_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compute", ".", "globals", " ", "can", "'", "t", " ", "be", " ", "pass", "ed", " ", "via", " ", "multipro", "cess", "ing", ".", "Process_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "name_", "==_", "'", "nt", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "compute_", "._", "globals_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "var_", "in_", "(_", "'", "Async", "Sock", "et", "'_", ",_", "'", "Disp", "y", "Jo", "b", "'_", ",_", "'", "serialize", "'_", ",_", "'", "unse", "rial", "ize", "'_", ",_", "'\\u", "Xf", "er", "File", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Max", "File", "Size", "'_", ",_", "'", "Msg", "Time", "out", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "compute_", "._", "globals_", "[_", "var_", "]_", "=_", "globals_", "(_", ")_", "[_", "var_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "compute_", "._", "globals_", "._", "update_", "(_", "self_", "._", "\\u\\u", "init", "\\u", "modules_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "compute_", "._", "globals_", "[_", "'\\u", "Disp", "y", "Node", "'_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "conn_", "._", "send", "\\u", "msg_", "(_", "serialize_", "(_", "self_", "._", "avail", "\\u", "cpus_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "computation", "s_", "[_", "compute_", "._", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute_", "._", "globals_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "scheduler_", "[_", "'", "ip", "\\u", "addr", "'_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "scheduler_", "[_", "'", "auth", "'_", "]_", "._", "discard_", "(_", "compute_", "._", "auth_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "remove_", "(_", "compute", "\\u", "save_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "compute_", "._", "dest", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "os_", "._", "rmdir_", "(_", "compute_", "._", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pulse", "\\u", "interval_", "=_", "num", "\\u", "min_", "(_", "self_", "._", "pulse", "\\u", "interval_", ",_", "compute_", "._", "pulse", "\\u", "interval_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "pulse", "\\u", "interval_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "pulse", "\\u", "interval_", "=_", "10_", "*_", "60_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "zombie", "\\u", "interval_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "pulse", "\\u", "interval_", "=_", "num", "\\u", "min_", "(_", "self_", "._", "pulse", "\\u", "interval_", ",_", "self_", "._", "zombie", "\\u", "interval_", "/_", "5.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "timer", "\\u", "coro_", "._", "resume_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "xfer", "\\u", "file", "\\u", "task_", "(_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xf_", "=_", "unse", "rial", "ize_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "'", "Ignor", "ing", " ", "file", " ", "tra", "sn", "fer", " ", "request", " ", "from", " ", "%", "s", "'_", ",_", "addr_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "compute_", "=_", "self_", "._", "computation", "s_", "._", "get_", "(_", "xf_", "._", "compute", "\\u", "id_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "compute_", "or_", "(_", "Max", "File", "Size_", "and_", "xf_", "._", "stat", "\\u", "buf_", "._", "st", "\\u", "size_", ">_", "Max", "File", "Size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "error_", "(_", "'", "Inva", "lid", " ", "file", " ", "transfer", " ", "for", " ", "\"%", "s", "\"'_", ",_", "xf_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "conn_", "._", "send", "\\u", "msg_", "(_", "serialize_", "(_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tgt_", "=_", "os_", "._", "path_", "._", "join_", "(_", "compute_", "._", "dest", "\\u", "path_", ",_", "os_", "._", "path_", "._", "basename_", "(_", "xf_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "tgt_", ")_", "and_", "\\u", "same", "\\u", "file_", "(_", "tgt_", ",_", "xf_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "tgt_", "in_", "compute_", "._", "file", "\\u", "uses_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "compute_", "._", "file", "\\u", "uses_", "[_", "tgt_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "compute_", "._", "file", "\\u", "uses_", "[_", "tgt_", "]_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "conn_", "._", "send", "\\u", "msg_", "(_", "serialize_", "(_", "xf_", "._", "stat", "\\u", "buf_", "._", "st", "\\u", "size_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "fd_", "=_", "open_", "(_", "tgt_", ",_", "'", "wb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recv", "d_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "'", "Copy", "ing", " ", "file", " ", "%", "s", " ", "to", " ", "%", "s", " ", "(%", "s", ")'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xf_", "._", "name_", ",_", "tgt_", ",_", "xf_", "._", "stat", "\\u", "buf_", "._", "st", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "recv", "d_", "<_", "xf_", "._", "stat", "\\u", "buf_", "._", "st", "\\u", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "yield_", "conn_", "._", "send", "\\u", "msg_", "(_", "serialize_", "(_", "recv", "d_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "yield_", "conn_", "._", "recv", "all_", "(_", "min_", "(_", "xf_", "._", "stat", "\\u", "buf_", "._", "st", "\\u", "size_", "-_", "recv", "d_", ",_", "1024", "000_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fd_", "._", "write_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recv", "d_", "+=_", "len_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "conn_", "._", "send", "\\u", "msg_", "(_", "serialize_", "(_", "recv", "d_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "'", "Copie", "d", " ", "file", " ", "%", "s", ",", " ", "%", "s", " ", "/", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tgt_", ",_", "recv", "d_", ",_", "xf_", "._", "stat", "\\u", "buf_", "._", "st", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "recv", "d_", "==_", "xf_", "._", "stat", "\\u", "buf_", "._", "st", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "utime", "_", "(_", "tgt_", ",_", "(_", "xf_", "._", "stat", "\\u", "buf_", "._", "st", "\\u", "atime", "_", ",_", "xf_", "._", "stat", "\\u", "buf_", "._", "st", "\\u", "mtime_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chmod_", "(_", "tgt_", ",_", "stat_", "._", "S", "\\u", "IMO", "DE_", "(_", "xf_", "._", "stat", "\\u", "buf_", "._", "st", "\\u", "mode_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "disp", "y", "\\u", "logger_", "._", "warning_", "(_", "'", "Copy", "ing", " ", "file", " ", "\"%", "s", "\"", " ", "fail", "ed", " ", "with", " ", "\"%", "s", "\"'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xf_", "._", "name_", ",_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "remove_", "(_", "tgt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "tgt_", "in_", "compute_", "._", "file", "\\u", "uses_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "compute_", "._", "file", "\\u", "uses_", "[_", "tgt_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "compute_", "._", "file", "\\u", "uses_", "[_", "tgt_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "#", " ", "xfer", "\\u", "file", "\\u", "task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "computation", "_", "(_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "compute", "\\u", "id_", "=_", "unse", "rial", "ize_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute_", "=_", "self_", "._", "computation", "s_", "[_", "compute", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "compute_", "._", "setup_", ",_", "\\u", "Function_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chdir_", "(_", "compute_", "._", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "vars_", "=_", "{_", "'\\u", "disp", "y", "\\u", "setup", "\\u", "args", "'_", ":_", "compute_", "._", "setup_", "._", "args_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "disp", "y", "\\u", "setup", "\\u", "kwarg", "s", "'_", ":_", "compute_", "._", "setup_", "._", "kwargs_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "name_", "==_", "'", "nt", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "global", "vars_", "=_", "globals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "global", "vars_", "=_", "compute_", "._", "globals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exec_", "(_", "marshal_", "._", "loads_", "(_", "compute_", "._", "code_", ")_", ")_", "in_", "global", "vars_", ",_", "local", "vars_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exec_", "(_", "'", "assert", " ", "%", "s", "(*", "\\u", "disp", "y", "\\u", "setup", "\\u", "args", ",", " ", "**", "\\u", "disp", "y", "\\u", "setup", "\\u", "kwarg", "s", ")", " ", "==", " ", "0", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "compute_", "._", "setup_", "._", "name_", ")_", "in_", "global", "vars_", ",_", "local", "vars_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "name_", "==_", "'", "nt", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "compute_", "._", "globals_", "._", "update_", "(_", "{_", "var_", ":_", "globals_", "(_", ")_", "[_", "var_", "]_", "for_", "var_", "in_", "globals_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "var_", "not_", "in_", "self_", "._", "\\u\\u", "init", "\\u", "globals_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "'", "Set", "up", " ", "fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "._", "encode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "=_", "'", "AC", "K", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "resp_", "!=_", "'", "AC", "K", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "compute_", "._", "cleanup_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "compute_", "._", "cleanup_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "compute_", "._", "zombie", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clean", "up", "\\u", "computation", "_", "(_", "compute_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "conn_", "._", "send", "\\u", "msg_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "terminate", "\\u", "job", "\\u", "task_", "(_", "compute_", ",_", "job", "\\u", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "job", "\\u", "info_", "._", "proc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "'", "Terminati", "ng", " ", "job", " ", "%", "s", " ", "of", " ", "\"%", "s", "\"'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "job", "\\u", "info_", "._", "job", "\\u", "reply_", "._", "uid_", ",_", "compute_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "info_", "._", "proc_", "._", "terminate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "job", "\\u", "info_", "._", "proc_", ",_", "multiprocessing_", "._", "Process_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "x_", "in_", "range_", "(_", "20_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "job", "\\u", "info_", "._", "proc_", "._", "is", "\\u", "alive_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "yield_", "coro_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "'", "Process", " ", "\"%", "s", "\"", " ", "for", " ", "job", " ", "%", "s", " ", "terminate", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "compute_", "._", "name_", ",_", "job", "\\u", "info_", "._", "job", "\\u", "reply_", "._", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "disp", "y", "\\u", "logger_", "._", "warning_", "(_", "'", "Cou", "ld", " ", "not", " ", "kill", " ", "process", " ", "%", "s", "'_", ",_", "compute_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "job", "\\u", "info_", "._", "proc_", ",_", "subprocess_", "._", "Popen_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "range_", "(_", "20_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "rc_", "=_", "job", "\\u", "info_", "._", "proc_", "._", "poll_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "'", "Program", " ", "\"%", "s", "\"", " ", "for", " ", "job", " ", "%", "s", " ", "terminate", "d", " ", "with", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "compute_", "._", "name_", ",_", "job", "\\u", "info_", "._", "job", "\\u", "reply_", "._", "uid_", ",_", "rc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rc_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "x_", "==_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "'", "Kill", "ing", " ", "job", " ", "%", "s", "'_", ",_", "job", "\\u", "info_", "._", "job", "\\u", "reply_", "._", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "info_", "._", "proc_", "._", "kill_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "coro_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "disp", "y", "\\u", "logger_", "._", "warning_", "(_", "'", "Cou", "ld", " ", "not", " ", "kill", " ", "process", " ", "%", "s", "'_", ",_", "compute_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "job", "\\u", "info_", "._", "job", "\\u", "reply_", "._", "end", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "info_", "._", "proc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "thread", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "job", "\\u", "infos_", "._", "get_", "(_", "job", "\\u", "info_", "._", "job", "\\u", "reply_", "._", "uid_", ",_", "None_", ")_", "==_", "job", "\\u", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "job", "\\u", "info_", "._", "job", "\\u", "reply_", "._", "status_", "=_", "Disp", "y", "Job_", "._", "Terminate", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "repl", "y", "\\u", "Q_", "._", "put_", "(_", "job", "\\u", "info_", "._", "job", "\\u", "reply_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "thread", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "retrieve", "\\u", "job", "\\u", "task_", "(_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "generator_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "send", "\\u", "reply_", "(_", "reply_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "yield_", "conn_", "._", "send", "\\u", "msg_", "(_", "serialize_", "(_", "reply_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Sto", "p", "Iteration_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "unse", "rial", "ize_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uid_", "=_", "req_", "[_", "'", "uid", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute", "\\u", "id_", "=_", "req_", "[_", "'", "compute", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auth_", "=_", "req_", "[_", "'", "auth", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "hash_", "=_", "req_", "[_", "'", "hash", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "send", "\\u", "reply_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pkl", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "dest", "\\u", "path", "\\u", "prefix_", ",_", "'%", "s", "\\u", "%", "s", "'_", "%_", "(_", "compute", "\\u", "id_", ",_", "auth_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute_", "=_", "self_", "._", "computation", "s_", "._", "get_", "(_", "compute", "\\u", "id_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "compute_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fd_", "=_", "open_", "(_", "pkl", "\\u", "path_", ",_", "'", "rb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute_", "=_", "pickle_", "._", "load_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "compute_", "or_", "compute_", "._", "auth_", "!=_", "auth_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "send", "\\u", "reply_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "info", "\\u", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "compute_", "._", "dest", "\\u", "path_", ",_", "'\\u", "disp", "y", "\\u", "job", "\\u", "repl", "y", "\\u", "%", "s", "'_", "%_", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "info", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "send", "\\u", "reply_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fd_", "=_", "open_", "(_", "info", "\\u", "file_", ",_", "'", "rb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "reply_", "=_", "pickle_", "._", "load_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "job", "\\u", "reply_", "._", "hash_", "==_", "job", "\\u", "hash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "send", "\\u", "reply_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "conn_", "._", "send", "\\u", "msg_", "(_", "serialize_", "(_", "job", "\\u", "reply_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ack_", "=_", "yield_", "conn_", "._", "recv", "\\u", "msg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ack_", "==_", "'", "AC", "K", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute_", "._", "pend", "ing", "\\u", "results_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "=_", "open_", "(_", "pkl", "\\u", "path_", ",_", "'", "wb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pickle_", "._", "dump_", "(_", "compute_", ",_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "os_", "._", "remove_", "(_", "info", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "compute_", "._", "pend", "ing", "\\u", "results_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "clean", "up", "\\u", "computation", "_", "(_", "compute_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tcp", "\\u", "serve", "\\u", "task", " ", "starts_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "yield_", "conn_", "._", "recv", "all_", "(_", "len_", "(_", "self_", "._", "auth_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "warning_", "(_", "'", "Ignor", "ing", " ", "request", ";", " ", "invalid", " ", "client", " ", "authenticat", "ion", "?'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_", "=_", "yield_", "conn_", "._", "recv", "\\u", "msg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "req_", "!=_", "self_", "._", "auth_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "msg_", "._", "startswith_", "(_", "'", "PING", ":'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "warning_", "(_", "'", "Ignor", "ing", " ", "request", ";", " ", "invalid", " ", "client", " ", "authenticat", "ion", "?'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "msg_", "._", "startswith_", "(_", "'", "JOB", ":'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "msg_", "[_", "len_", "(_", "'", "JOB", ":'_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "job", "\\u", "request", "\\u", "task_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "msg_", "._", "startswith_", "(_", "'", "COMPUTE", ":'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "msg_", "[_", "len_", "(_", "'", "COMPUTE", ":'_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "add", "\\u", "computation", "\\u", "task_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "msg_", "._", "startswith_", "(_", "'", "FILE", "XF", "ER", ":'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "msg_", "[_", "len_", "(_", "'", "FILE", "XF", "ER", ":'_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "xfer", "\\u", "file", "\\u", "task_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "msg_", "._", "startswith_", "(_", "'", "SETUP", ":'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "msg_", "[_", "len_", "(_", "'", "SETUP", ":'_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "setup", "\\u", "computation", "_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "msg_", "._", "startswith_", "(_", "'", "CLOSE", ":'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "msg_", "[_", "len_", "(_", "'", "CLOSE", ":'_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "=_", "unse", "rial", "ize_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute", "\\u", "id_", "=_", "info_", "[_", "'", "compute", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auth_", "=_", "info_", "[_", "'", "auth", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "terminate", "\\u", "pending_", "=_", "info_", "._", "get_", "(_", "'", "terminate", "\\u", "pend", "ing", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "'", "Del", "eti", "ng", " ", "computation", " ", "fail", "ed", " ", "with", " ", "%", "s", "'_", ",_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "compute_", "=_", "self_", "._", "computation", "s_", "._", "get_", "(_", "compute", "\\u", "id_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "compute_", "is_", "None_", "or_", "compute_", "._", "auth_", "!=_", "auth_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "disp", "y", "\\u", "logger_", "._", "warning_", "(_", "'", "Computation", " ", "\"%", "s", "\"", " ", "is", " ", "not", " ", "valid", "'_", ",_", "compute", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "compute_", "._", "zombie", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "terminate", "\\u", "pending_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "thread", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "infos_", "=_", "[_", "job", "\\u", "info_", "for_", "job", "\\u", "info_", "in_", "self_", "._", "job", "\\u", "infos_", "._", "values_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "job", "\\u", "info_", "._", "compute", "\\u", "id_", "==_", "compute", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "thread", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "job", "\\u", "info_", "in_", "job", "\\u", "infos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "yield_", "terminate", "\\u", "job", "\\u", "task_", "(_", "compute_", ",_", "job", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "clean", "up", "\\u", "computation", "_", "(_", "compute_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "conn_", "._", "send", "\\u", "msg_", "(_", "'", "AC", "K", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "msg_", "._", "startswith_", "(_", "'", "TERMINAT", "E", "\\u", "JOB", ":'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "msg_", "[_", "len_", "(_", "'", "TERMINAT", "E", "\\u", "JOB", ":'_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "job_", "=_", "unse", "rial", "ize_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute_", "=_", "self_", "._", "computation", "s_", "[_", "\\u", "job_", "._", "compute", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "assert", " ", "addr", "[", "0", "]", " ", "==", " ", "compute", ".", "schedule", "r", "\\u", "ip", "\\u", "addr_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "thread", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "info_", "=_", "self_", "._", "job", "\\u", "infos_", "._", "get_", "(_", "\\u", "job_", "._", "uid_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "thread", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "job", "\\u", "info_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "'", "Inva", "lid", " ", "terminate", " ", "job", " ", "request", " ", "from", " ", "%", "s", ",", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "addr_", "[_", "0_", "]_", ",_", "compute_", "._", "schedule", "r", "\\u", "ip", "\\u", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "terminate", "\\u", "job", "\\u", "task_", "(_", "compute_", ",_", "job", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "msg_", "._", "startswith_", "(_", "'", "RESE", "ND", "\\u", "JOB", "\\u", "RESULTS", ":'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "msg_", "[_", "len_", "(_", "'", "RESE", "ND", "\\u", "JOB", "\\u", "RESULTS", ":'_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "=_", "unse", "rial", "ize_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute", "\\u", "id_", "=_", "info_", "[_", "'", "compute", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auth_", "=_", "info_", "[_", "'", "auth", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reply_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "compute_", "=_", "self_", "._", "computation", "s_", "._", "get_", "(_", "compute", "\\u", "id_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "compute_", "is_", "None_", "or_", "compute_", "._", "auth_", "!=_", "auth_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "fd_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "dest", "\\u", "path", "\\u", "prefix_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", "\\u", "%", "s", "'_", "%_", "(_", "compute", "\\u", "id_", ",_", "auth_", ")_", ")_", ",_", "'", "rb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute_", "=_", "pickle_", "._", "load_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "compute_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "reply_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "reply_", "=_", "compute_", "._", "pend", "ing", "\\u", "results_", "+_", "compute_", "._", "pend", "ing", "\\u", "jobs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "conn_", "._", "send", "\\u", "msg_", "(_", "serialize_", "(_", "reply_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "reply_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "resen", "d\\u", "job", "\\u", "results_", "(_", "compute_", ",_", "coro_", "=_", "coro_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "msg_", "._", "startswith_", "(_", "'", "PING", ":'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "=_", "unse", "rial", "ize_", "(_", "msg_", "[_", "len_", "(_", "'", "PING", ":'_", ")_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "info_", "[_", "'", "version", "'_", "]_", "==_", "\\u", "disp", "y", "\\u", "version_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "self_", "._", "scheduler_", "[_", "'", "ip", "\\u", "addr", "'_", "]_", "and_", "not_", "self_", "._", "job", "\\u", "infos_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Cor", "o_", "(_", "self_", "._", "send", "\\u", "pong", "\\u", "msg_", ",_", "info_", ",_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "msg_", "._", "startswith_", "(_", "'", "PEND", "ING", "\\u", "JOB", "S", ":'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "msg_", "[_", "len_", "(_", "'", "PEND", "ING", "\\u", "JOB", "S", ":'_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reply_", "=_", "{_", "'", "don", "e", "'_", ":_", "[_", "]_", ",_", "'", "pend", "ing", "'_", ":_", "0_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "=_", "unse", "rial", "ize_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute", "\\u", "id_", "=_", "info_", "[_", "'", "compute", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auth_", "=_", "info_", "[_", "'", "auth", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "compute_", "=_", "self_", "._", "computation", "s_", "._", "get_", "(_", "compute", "\\u", "id_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "compute_", "is_", "None_", "or_", "compute_", "._", "auth_", "!=_", "auth_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "fd_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "dest", "\\u", "path", "\\u", "prefix_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", "\\u", "%", "s", "'_", "%_", "(_", "compute", "\\u", "id_", ",_", "auth_", ")_", ")_", ",_", "'", "rb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute_", "=_", "pickle_", "._", "load_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "compute_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "done_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "compute_", "._", "pend", "ing", "\\u", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "result", "\\u", "file_", "in_", "glob_", "._", "glob_", "(_", "os_", "._", "path_", "._", "join_", "(_", "compute_", "._", "dest", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "disp", "y", "\\u", "job", "\\u", "repl", "y", "\\u*", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "result", "\\u", "file_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "result", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "uid_", "=_", "int_", "(_", "result", "\\u", "file_", "[_", "len_", "(_", "'\\u", "disp", "y", "\\u", "job", "\\u", "repl", "y", "\\u'_", ")_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "done_", "._", "append_", "(_", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "limit", " ", "so", " ", "as", " ", "not", " ", "to", " ", "take", " ", "up", " ", "too", " ", "muc", "h", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "done_", ")_", ">_", "50_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "reply_", "[_", "'", "don", "e", "'_", "]_", "=_", "done_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reply_", "[_", "'", "pend", "ing", "'_", "]_", "=_", "compute_", "._", "pend", "ing", "\\u", "jobs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "conn_", "._", "send", "\\u", "msg_", "(_", "serialize_", "(_", "reply_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "msg_", "._", "startswith_", "(_", "'", "RETRIE", "VE", "\\u", "JOB", ":'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "msg_", "[_", "len_", "(_", "'", "RETRIE", "VE", "\\u", "JOB", ":'_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "retrieve", "\\u", "job", "\\u", "task_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "warning_", "(_", "'", "Inva", "lid", " ", "request", " ", "\"%", "s", "\"", " ", "from", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "[_", ":_", "min_", "(_", "10_", ",_", "len_", "(_", "msg_", ")_", ")_", "]_", ",_", "addr_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "(_", "'", "NA", "K", " ", "(", "invalid", " ", "command", ":", " ", "%", "s", ")'_", "%_", "(_", "msg_", "[_", ":_", "min_", "(_", "10_", ",_", "len_", "(_", "msg_", ")_", ")_", "]_", ")_", ")_", "._", "encode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "conn_", "._", "send", "\\u", "msg_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "warning_", "(_", "'", "Fail", "ed", " ", "to", " ", "send", " ", "repl", "y", " ", "to", " ", "%", "s", "'_", ",_", "str_", "(_", "addr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Disp", "y", "Node_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "resen", "d\\u", "job", "\\u", "results_", "(_", "self_", ",_", "compute_", ",_", "coro_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "limit", " ", "number", " ", "queue", "d", " ", "so", " ", "as", " ", "not", " ", "to", " ", "take", " ", "up", " ", "too", " ", "muc", "h", " ", "space", "/", "time_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "compute_", "._", "dest", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result", "\\u", "files_", "=_", "[_", "f_", "for_", "f_", "in_", "os_", "._", "listdir_", "(_", "compute_", "._", "dest", "\\u", "path_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "f_", "._", "startswith_", "(_", "'\\u", "disp", "y", "\\u", "job", "\\u", "repl", "y", "\\u'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "files_", "=_", "result", "\\u", "files_", "[_", ":_", "min_", "(_", "len_", "(_", "result", "\\u", "files_", ")_", ",_", "64_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "result", "\\u", "file_", "in_", "result", "\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result", "\\u", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "compute_", "._", "dest", "\\u", "path_", ",_", "result", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fd_", "=_", "open_", "(_", "result", "\\u", "file_", ",_", "'", "rb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "result_", "=_", "pickle_", "._", "load_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "'", "Cou", "ld", " ", "not", " ", "load", " ", "\"%", "s", "\"'_", ",_", "result", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "\\u", "disp", "y", "\\u", "logg", "er", ".", "debug", "(", "traceback", ".", "format\\u", "exc", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "job", "\\u", "info_", "=_", "\\u", "Disp", "y", "Jo", "b", "Info_", "(_", "job", "\\u", "result_", ",_", "(_", "compute_", "._", "schedule", "r", "\\u", "ip", "\\u", "addr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "compute_", "._", "job", "\\u", "result", "\\u", "port_", ")_", ",_", "compute_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "yield_", "self_", "._", "\\u", "send", "\\u", "job", "\\u", "reply_", "(_", "job", "\\u", "info_", ",_", "resen", "ding_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "status_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Disp", "y", "Node_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "job", "\\u", "program_", "(_", "self_", ",_", "\\u", "job_", ",_", "job", "\\u", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "compute_", "=_", "self_", "._", "computation", "s_", "[_", "\\u", "job_", "._", "compute", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "compute_", "._", "name_", "._", "endswith_", "(_", "'.", "py", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "program_", "=_", "[_", "sys_", "._", "executable_", ",_", "compute_", "._", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "program_", "=_", "[_", "compute_", "._", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "=_", "unse", "rial", "ize_", "(_", "\\u", "job_", "._", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "program_", "._", "extend_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reply_", "=_", "job", "\\u", "info_", "._", "job", "\\u", "reply_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "chdir_", "(_", "compute_", "._", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "update_", "(_", "os_", "._", "environ_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "[_", "'", "PATH", "'_", "]_", "=_", "compute_", "._", "dest", "\\u", "path_", "+_", "os_", "._", "pathsep_", "+_", "env_", "[_", "'", "PATH", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "info_", "._", "proc_", "=_", "subprocess_", "._", "Popen_", "(_", "program_", ",_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stderr_", "=_", "subprocess_", "._", "PIPE_", ",_", "env_", "=_", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "isinstance_", "(_", "job", "\\u", "info_", "._", "proc_", ",_", "subprocess_", "._", "Popen_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reply_", "._", "stdout_", ",_", "reply_", "._", "stderr_", "=_", "job", "\\u", "info_", "._", "proc_", "._", "communicate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reply_", "._", "result_", "=_", "job", "\\u", "info_", "._", "proc_", "._", "returncode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reply_", "._", "status_", "=_", "Disp", "y", "Job_", "._", "Finished_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reply_", "._", "exception_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reply_", "._", "status_", "=_", "Disp", "y", "Job_", "._", "Terminate", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "reply_", "._", "end", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "info_", "._", "proc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "repl", "y", "\\u", "Q_", "._", "put_", "(_", "reply_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Disp", "y", "Node_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repl", "y", "\\u", "Q_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "job", "\\u", "reply_", "=_", "self_", "._", "repl", "y", "\\u", "Q_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "job", "\\u", "reply_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "thread", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "info_", "=_", "self_", "._", "job", "\\u", "infos_", "._", "get_", "(_", "job", "\\u", "reply_", "._", "uid_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "job", "\\u", "info_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "job", "\\u", "info_", "._", "job", "\\u", "reply_", "=_", "job", "\\u", "reply_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "thread", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "job", "\\u", "info_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "num", "\\u", "jobs_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cpu", "\\u", "time_", "+=_", "(_", "job", "\\u", "reply_", "._", "end", "\\u", "time_", "-_", "job", "\\u", "reply_", "._", "start", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "job", "\\u", "info_", "._", "proc_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "isinstance_", "(_", "job", "\\u", "info_", "._", "proc_", ",_", "multiprocessing_", "._", "Process_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "job", "\\u", "info_", "._", "proc_", "._", "join_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "job", "\\u", "info_", "._", "proc_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Cor", "o_", "(_", "self_", "._", "\\u", "send", "\\u", "job", "\\u", "reply_", ",_", "job", "\\u", "info_", ",_", "resen", "ding_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute_", "=_", "self_", "._", "computation", "s_", "._", "get_", "(_", "job", "\\u", "info_", "._", "compute", "\\u", "id_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "compute_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "xf_", "in_", "job", "\\u", "info_", "._", "xfer", "\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "compute_", "._", "dest", "\\u", "path_", ",_", "os_", "._", "path_", "._", "basename_", "(_", "xf_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "compute_", "._", "file", "\\u", "uses_", "[_", "path_", "]_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "compute_", "._", "file", "\\u", "uses_", "[_", "path_", "]_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "compute_", "._", "file", "\\u", "uses_", "._", "pop_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "remove_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "warning_", "(_", "'", "invalid", " ", "file", " ", "\"%", "s", "\"", " ", "ignore", "d", "'_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Disp", "y", "Node_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean", "up", "\\u", "computation", "_", "(_", "self_", ",_", "compute_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "compute_", "._", "zombie", "_", "or_", "compute_", "._", "pend", "ing", "\\u", "jobs_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "compute_", "._", "pend", "ing", "\\u", "jobs_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "'", "pend", "ing", " ", "jobs", " ", "for", " ", "computation", " ", "\"%", "s", "\"/%", "s", ":", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "compute_", "._", "name_", ",_", "compute_", "._", "id_", ",_", "compute_", "._", "pend", "ing", "\\u", "jobs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "computation", "s_", "._", "pop_", "(_", "compute_", "._", "id_", ",_", "None_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "warning_", "(_", "'", "Inva", "lid", " ", "computation", " ", "\"%", "s", "\"", " ", "to", " ", "clean", "up", " ", "ignore", "d", "'_", ",_", "compute_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "num", "\\u", "computation", "s_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "uses_", ",_", "compute_", "._", "file", "\\u", "uses_", "=_", "compute_", "._", "file", "\\u", "uses_", ",_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global", "vars_", ",_", "compute_", "._", "globals_", "=_", "compute_", "._", "globals_", ",_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkl", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "dest", "\\u", "path", "\\u", "prefix_", ",_", "'%", "s", "\\u", "%", "s", "'_", "%_", "(_", "compute_", "._", "id_", ",_", "compute_", "._", "auth_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "compute_", "._", "pend", "ing", "\\u", "results_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "pkl", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "warning_", "(_", "'", "Cou", "ld", " ", "not", " ", "remove", " ", "\"%", "s", "\"'_", ",_", "pkl", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fd_", "=_", "open_", "(_", "pkl", "\\u", "path_", ",_", "'", "wb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pickle_", "._", "dump_", "(_", "compute_", ",_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "scheduler_", "[_", "'", "auth", "'_", "]_", "._", "discard_", "(_", "compute_", "._", "auth_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "(_", "not_", "self_", "._", "computation", "s_", ")_", "and_", "(_", "not_", "self_", "._", "scheduler_", "[_", "'", "auth", "'_", "]_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "compute_", "._", "schedule", "r", "\\u", "ip", "\\u", "addr_", "==_", "self_", "._", "scheduler_", "[_", "'", "ip", "\\u", "addr", "'_", "]_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "compute_", "._", "schedule", "r", "\\u", "port_", "==_", "self_", "._", "scheduler_", "[_", "'", "port", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "scheduler_", "[_", "'", "ip", "\\u", "addr", "'_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pulse", "\\u", "interval_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timer", "\\u", "coro_", "._", "resume_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "serve_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "serve_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Cor", "o_", "(_", "self_", "._", "broadcast", "\\u", "ping", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "compute_", "._", "cleanup_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "serve_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "shutdown_", "(_", "quit_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "chdir_", "(_", "self_", "._", "dest", "\\u", "path", "\\u", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "compute_", "._", "cleanup_", ",_", "\\u", "Function_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local", "vars_", "=_", "{_", "'\\u", "disp", "y", "\\u", "clean", "up", "\\u", "args", "'_", ":_", "compute_", "._", "cleanup_", "._", "args_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "disp", "y", "\\u", "clean", "up", "\\u", "kwarg", "s", "'_", ":_", "compute_", "._", "cleanup_", "._", "kwargs_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "name_", "==_", "'", "nt", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "global", "vars_", "=_", "globals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exec_", "(_", "marshal_", "._", "loads_", "(_", "compute_", "._", "code_", ")_", ")_", "in_", "global", "vars_", ",_", "local", "vars_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exec_", "(_", "'%", "s", "(*", "\\u", "disp", "y", "\\u", "clean", "up", "\\u", "args", ",", " ", "**", "\\u", "disp", "y", "\\u", "clean", "up", "\\u", "kwarg", "s", ")'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "compute_", "._", "cleanup_", "._", "name_", ")_", "in_", "global", "vars_", ",_", "local", "vars_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "'", "Clean", "up", " ", "\"%", "s", "\"", " ", "fail", "ed", "'_", ",_", "compute_", "._", "cleanup_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "name_", "==_", "'", "nt", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "var_", "in_", "globals_", "(_", ")_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "var_", "not_", "in_", "self_", "._", "\\u\\u", "init", "\\u", "globals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "'", "Varia", "ble", " ", "\"%", "s", "\"", " ", "left", " ", "beh", "ind", " ", "by", " ", "\"%", "s", "\"", " ", "at", " ", "%", "s", " ", "is", " ", "bei", "ng", " ", "remove", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "var_", ",_", "compute_", "._", "name_", ",_", "compute_", "._", "schedule", "r", "\\u", "ip", "\\u", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "globals_", "(_", ")_", "._", "pop_", "(_", "var_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "var_", ",_", "value_", "in_", "self_", "._", "\\u\\u", "init", "\\u", "globals_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "var_", "in_", "(_", "'\\u", "disp", "y", "\\u", "node", "'_", ",_", "'\\u", "disp", "y", "\\u", "conn", "'_", ",_", "'\\u", "disp", "y", "\\u", "addr", "'_", ",_", "'\\u", "disp", "y", "\\u", "config", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "!=_", "globals_", "(_", ")_", "._", "get_", "(_", "var_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "disp", "y", "\\u", "logger_", "._", "warning_", "(_", "'", "Varia", "ble", " ", "\"%", "s", "\"", " ", "change", "d", " ", "by", " ", "\"%", "s", "\"", " ", "at", " ", "%", "s", " ", "is", " ", "bei", "ng", " ", "reset", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "var_", ",_", "compute_", "._", "name_", ",_", "compute_", "._", "schedule", "r", "\\u", "ip", "\\u", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "globals_", "(_", ")_", "[_", "var_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "module_", "in_", "sys_", "._", "modules_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "module_", "not_", "in_", "compute_", "._", "ante", "\\u", "modules_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "modules_", "._", "pop_", "(_", "module_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sys_", "._", "modules_", "._", "update_", "(_", "self_", "._", "\\u\\u", "init", "\\u", "modules_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "path_", "in_", "os_", "._", "listdir_", "(_", "compute_", "._", "dest", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "compute_", "._", "dest", "\\u", "path_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "file", "\\u", "uses_", "._", "get_", "(_", "path_", ",_", "1_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "path_", ")_", "or_", "os_", "._", "path_", "._", "islink_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "os_", "._", "remove_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "os_", "._", "path_", "._", "isdir_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "shutil_", "._", "rmtree_", "(_", "path_", ",_", "ignore", "\\u", "errors_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "os_", "._", "remove_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "disp", "y", "\\u", "logger_", "._", "warning_", "(_", "'", "Cou", "ld", " ", "not", " ", "remove", " ", "\"%", "s", "\"'_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "compute_", "._", "dest", "\\u", "path_", ")_", "and_", "compute_", "._", "dest", "\\u", "path_", "._", "startswith_", "(_", "self_", "._", "dest", "\\u", "path", "\\u", "prefix_", ")_", "and_", "len_", "(_", "os_", "._", "listdir_", "(_", "compute_", "._", "dest", "\\u", "path_", ")_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "rmdir_", "(_", "compute_", "._", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "warning_", "(_", "'", "Cou", "ld", " ", "not", " ", "remove", " ", "director", "y", " ", "\"%", "s", "\"'_", ",_", "compute_", "._", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "'", "Remove", "d", " ", "\"%", "s", "\"'_", ",_", "compute_", "._", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "serve_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "shutdown_", "(_", "quit_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Disp", "y", "Node_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "shutdown_", "(_", "self_", ",_", "quit_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "shutdown_", "(_", "self_", ",_", "quit_", ",_", "coro_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "thread", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "infos_", ",_", "self_", "._", "job", "\\u", "infos_", "=_", "self_", "._", "job", "\\u", "infos_", ",_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "quit_", "and_", "self_", "._", "repl", "y", "\\u", "Q_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "repl", "y", "\\u", "Q_", "._", "put_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "scheduler_", "[_", "'", "ip", "\\u", "addr", "'_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "scheduler_", "[_", "'", "auth", "'_", "]_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "avail", "\\u", "cpus_", "+=_", "len_", "(_", "job", "\\u", "infos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "avail", "\\u", "cpus_", "!=_", "self_", "._", "num", "\\u", "cpus_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disp", "y", "\\u", "logger_", "._", "warning_", "(_", "'", "invalid", " ", "cpus", ":", " ", "%", "s", " ", "/", " ", "%", "s", "'_", ",_", "self_", "._", "avail", "\\u", "cpus_", ",_", "self_", "._", "num", "\\u", "cpus_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "thread", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "uid_", ",_", "job", "\\u", "info_", "in_", "job", "\\u", "infos_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "job", "\\u", "info_", "._", "proc_", "._", "terminate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "'", "process", " ", "for", " ", "%", "s", " ", "is", " ", "kille", "d", "'_", ",_", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "job", "\\u", "info_", "._", "proc_", ",_", "multiprocessing_", "._", "Process_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "job", "\\u", "info_", "._", "proc_", "._", "join_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "job", "\\u", "info_", "._", "proc_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "cid_", ",_", "compute_", "in_", "self_", "._", "computation", "s_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sock_", "=_", "Async", "Socket_", "(_", "socket_", "._", "socket_", "(_", "socket_", "._", "AF", "\\u", "INET_", ",_", "socket_", "._", "SOCK", "\\u", "STREAM_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keyfile_", "=_", "self_", "._", "keyfile_", ",_", "certfile", "_", "=_", "self_", "._", "certfile", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "._", "settimeout_", "(_", "Msg", "Timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disp", "y", "\\u", "logger_", "._", "debug_", "(_", "'", "Sen", "ding", " ", "TERMINAT", "E", " ", "to", " ", "%", "s", "'_", ",_", "compute_", "._", "schedule", "r", "\\u", "ip", "\\u", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "{_", "'", "ip", "\\u", "addr", "'_", ":_", "self_", "._", "ext", "\\u", "ip", "\\u", "addr_", ",_", "'", "port", "'_", ":_", "self_", "._", "port_", ",_", "'", "sign", "'_", ":_", "self_", "._", "sign_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "yield_", "sock_", "._", "connect_", "(_", "(_", "compute_", "._", "schedule", "r", "\\u", "ip", "\\u", "addr_", ",_", "compute_", "._", "schedule", "r", "\\u", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "sock_", "._", "send", "\\u", "msg_", "(_", "'", "TERMINAT", "ED", ":'_", "._", "encode_", "(_", ")_", "+_", "serialize_", "(_", "info_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sock_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute_", "._", "pend", "ing", "\\u", "jobs_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute_", "._", "zombie", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clean", "up", "\\u", "computation", "_", "(_", "compute_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "quit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tcp", "\\u", "coro_", "._", "terminate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sign_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "sign_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Cor", "o_", "(_", "\\u", "shutdown_", ",_", "self_", ",_", "quit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Disp", "y", "Node_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "stdin_", "(_", "self_", ",_", "coro_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coro_", "._", "set\\u", "daemon_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread", "\\u", "pool_", "=_", "async", "oro", "_", "._", "Async", "Thread", "Pool_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stdout_", "._", "write_", "(_", "'\\\\", "n", "Enter", " ", "\"", "quit", "\"", " ", "or", " ", "\"", "exit", "\"", " ", "to", " ", "terminate", " ", "disp", "yn", "ode", ",\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", "\"", "stop", "\"", " ", "to", " ", "stop", " ", "service", ",", " ", "\"", "start", "\"", " ", "to", " ", "restart", " ", "service", ",\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", "\"", "cpus", "\"", " ", "to", " ", "change", " ", "CPU", "s", " ", "used", ",", " ", "anyt", "hing", " ", "else", " ", "to", " ", "get", " ", "status", ":", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", "=_", "yield_", "thread", "\\u", "pool_", "._", "async", "\\u", "task_", "(_", "raw", "\\u", "input_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "=_", "cmd_", "._", "strip_", "(_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cmd_", "in_", "(_", "'", "quit", "'_", ",_", "'", "exit", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "in_", "(_", "'", "stop", "'_", ",_", "'", "start", "'_", ",_", "'", "cpus", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cmd_", "==_", "'", "stop", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cpus_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "==_", "'", "start", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cpus_", "=_", "self_", "._", "num", "\\u", "cpus_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "==_", "'", "cpus", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cpus_", "=_", "multiprocessing_", "._", "cpu", "\\u", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "'", "Enter", " ", "number", " ", "of", " ", "CPU", "s", " ", "to", " ", "use", " ", "in", " ", "range", " ", "-%", "s", " ", "to", " ", "%", "s", ":", " ", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "cpus_", "-_", "1_", ",_", "cpus_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "cpus_", "=_", "yield_", "thread", "\\u", "pool_", "._", "async", "\\u", "task_", "(_", "raw", "\\u", "input_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpus_", "=_", "int_", "(_", "cpus_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cpus_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "assert_", "cpus_", "<=_", "multiprocessing_", "._", "cpu", "\\u", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "cpus_", "+=_", "multiprocessing_", "._", "cpu", "\\u", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "cpus_", ">=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "(_", "'", " ", " ", "Inva", "lid", " ", "cpus", " ", "ignore", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "num", "\\u", "cpus_", "=_", "cpus_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "avail", "\\u", "cpus_", "=_", "cpus_", "-_", "len_", "(_", "self_", "._", "job", "\\u", "infos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "scheduler_", "[_", "'", "ip", "\\u", "addr", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sock_", "=_", "Async", "Socket_", "(_", "socket_", "._", "socket_", "(_", "socket_", "._", "AF", "\\u", "INET_", ",_", "socket_", "._", "SOCK", "\\u", "STREAM_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keyfile_", "=_", "self_", "._", "keyfile_", ",_", "certfile", "_", "=_", "self_", "._", "certfile", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "._", "settimeout_", "(_", "Msg", "Timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "yield_", "sock_", "._", "connect_", "(_", "(_", "self_", "._", "scheduler_", "[_", "'", "ip", "\\u", "addr", "'_", "]_", ",_", "self_", "._", "scheduler_", "[_", "'", "port", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "{_", "'", "ip", "\\u", "addr", "'_", ":_", "self_", "._", "ext", "\\u", "ip", "\\u", "addr_", ",_", "'", "sign", "'_", ":_", "self_", "._", "sign_", ",_", "'", "cpus", "'_", ":_", "cpus_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "sock_", "._", "send", "\\u", "msg_", "(_", "'", "NODE", "\\u", "CPU", "S", ":'_", "._", "encode_", "(_", ")_", "+_", "serialize_", "(_", "info_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sock_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "self_", "._", "num", "\\u", "cpus_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "Cor", "o_", "(_", "self_", "._", "broadcast", "\\u", "ping", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", " ", " ", "Servi", "ng", " ", "%", "d", " ", "CPU", "s", "%", "s", "%", "s", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "avail", "\\u", "cpus_", "+_", "len_", "(_", "self_", "._", "job", "\\u", "infos_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "from", " ", "%", "s", "'_", "%_", "self_", "._", "seri", "vc", "e\\u", "start_", "if_", "self_", "._", "service", "\\u", "start_", "else_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "to", " ", "%", "s", "'_", "%_", "self_", "._", "service", "\\u", "end_", "if_", "self_", "._", "service", "\\u", "end_", "else_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "for", " ", "%", "d", " ", "clients", "'_", "%_", "self_", "._", "serve_", "if_", "self_", "._", "serve_", ">_", "0_", "else_", "''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", " ", "Complete", "d", ":\\\\", "n", " ", " ", " ", " ", "%", "d", " ", "Computation", "s", ",", " ", "%", "d", " ", "jobs", ",", " ", "%", ".3", "f", " ", "sec", " ", "CPU", " ", "time", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "num", "\\u", "computation", "s_", ",_", "self_", "._", "num", "\\u", "jobs_", ",_", "self_", "._", "cpu", "\\u", "time_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", " ", "Run", "ning", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "compute_", "in_", "enumerate_", "(_", "self_", "._", "computation", "s_", "._", "itervalues_", "(_", ")_", ",_", "start_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "'", " ", " ", " ", " ", "Client", " ", "%", "s", ":", " ", "%", "s", " ", "@", " ", "%", "s", " ", "runn", "ing", " ", "%", "s", " ", "jobs", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "i_", ",_", "compute_", "._", "name_", ",_", "compute_", "._", "schedule", "r", "\\u", "ip", "\\u", "addr_", ",_", "compute_", "._", "pend", "ing", "\\u", "jobs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "shutdown_", "(_", "quit_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
armbues/ioc_parser/iocp.py
[ { "content": "#!/usr/bin/env python\n\n###################################################################################################\n#\n# Copyright (c) 2015, Armin Buescher ([email protected])\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in all\n# copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n# SOFTWARE.\n#\n###################################################################################################\n#\n# File: iocp.py\n# Description: IOC Parser is a tool to extract indicators of compromise from security reports\n# in PDF format.\n# Usage: iocp.py [-h] [-p INI] [-f FORMAT] PDF\n# Author: Armin Buescher (@armbues)\n# Contributors: Angelo Dell'Aera (@angelodellaera)\n# Thanks to: Jose Ramon Palanco\n# Koen Van Impe (@cudeso)\n#\n###################################################################################################\n\nimport os\nimport sys\nimport fnmatch\nimport argparse\nimport re\nfrom StringIO import StringIO\ntry:\n import configparser as ConfigParser\nexcept ImportError:\n import ConfigParser\n\n# Import optional third-party libraries\nIMPORTS = []\ntry:\n from PyPDF2 import PdfFileReader\n IMPORTS.append('pypdf2')\nexcept ImportError:\n pass\ntry:\n from pdfminer.pdfpage import PDFPage\n from pdfminer.pdfinterp import PDFResourceManager\n from pdfminer.converter import TextConverter\n from pdfminer.pdfinterp import PDFPageInterpreter\n from pdfminer.layout import LAParams\n IMPORTS.append('pdfminer')\nexcept ImportError:\n pass\ntry:\n from bs4 import BeautifulSoup\n IMPORTS.append('beautifulsoup')\nexcept ImportError:\n pass\ntry:\n import requests\n IMPORTS.append('requests')\nexcept ImportError:\n pass\n\n# Import additional project source files\nimport output\nfrom whitelist import WhiteList\n\n\nif __name__ == \"__main__\":\n argparser = argparse.ArgumentParser()\n argparser.add_argument('PATH', action='store', help='File/directory/URL to report(s)')\n argparser.add_argument('-p', dest='INI', default=None, help='Pattern file')\n argparser.add_argument('-i', dest='INPUT_FORMAT', default='pdf', help='Input format (pdf/txt/html)')\n argparser.add_argument('-o', dest='OUTPUT_FORMAT', default='csv', help='Output format (csv/json/yara/netflow)')\n argparser.add_argument('-d', dest='DEDUP', action='store_true', default=False, help='Deduplicate matches')\n argparser.add_argument('-l', dest='LIB', default='pdfminer', help='PDF parsing library (pypdf2/pdfminer)')\n args = argparser.parse_args()\n\n parser = IOC_Parser(args.INI, args.INPUT_FORMAT, args.DEDUP, args.LIB, args.OUTPUT_FORMAT)\n parser.parse(args.PATH)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class IOC_Parser(object):\n patterns = {}\n defang = {}\n\n\n\n\n\n\n\n\n\n", "metadata": "root.IOC_Parser", "header": "['module', '___EOS___']", "index": 79 }, { "content": " def __init__(self, patterns_ini=None, input_format='pdf', dedup=False, library='pdfminer', output_format='csv', output_handler=None):\n basedir = os.path.dirname(os.path.abspath(__file__))\n if patterns_ini is None:\n patterns_ini = os.path.join(basedir, 'patterns.ini')\n\n self.load_patterns(patterns_ini)\n self.whitelist = WhiteList(basedir)\n self.dedup = dedup\n if output_handler:\n self.handler = output_handler\n else:\n self.handler = output.getHandler(output_format)\n\n self.ext_filter = \"*.\" + input_format\n parser_format = \"parse_\" + input_format\n try:\n self.parser_func = getattr(self, parser_format)\n except AttributeError:\n e = 'Selected parser format is not supported: %s' % (input_format)\n raise NotImplementedError(e)\n\n self.library = library\n if input_format == 'pdf':\n if library not in IMPORTS:\n e = 'Selected PDF parser library not found: %s' % (library)\n raise ImportError(e)\n elif input_format == 'html':\n if 'beautifulsoup' not in IMPORTS:\n e = 'HTML parser library not found: BeautifulSoup'\n raise ImportError(e)", "metadata": "root.IOC_Parser.__init__", "header": "['class', 'IOC_Parser', '(', 'object', ')', ':', '___EOS___']", "index": 83 }, { "content": " def load_patterns(self, fpath):\n config = ConfigParser.ConfigParser()\n with open(fpath) as f:\n config.readfp(f)\n\n for ind_type in config.sections():\n try:\n ind_pattern = config.get(ind_type, 'pattern')\n except:\n continue\n\n if ind_pattern:\n ind_regex = re.compile(ind_pattern)\n self.patterns[ind_type] = ind_regex\n\n try:\n ind_defang = config.get(ind_type, 'defang')\n except:\n continue\n\n if ind_defang:\n self.defang[ind_type] = True", "metadata": "root.IOC_Parser.load_patterns", "header": "['class', 'IOC_Parser', '(', 'object', ')', ':', '___EOS___']", "index": 114 }, { "content": " def is_whitelisted(self, ind_match, ind_type):\n try:\n for w in self.whitelist[ind_type]:\n if w.findall(ind_match):\n return True\n except KeyError as e:\n pass\n return False", "metadata": "root.IOC_Parser.is_whitelisted", "header": "['class', 'IOC_Parser', '(', 'object', ')', ':', '___EOS___']", "index": 137 }, { "content": " def parse_page(self, fpath, data, page_num):\n for ind_type, ind_regex in self.patterns.items():\n matches = ind_regex.findall(data)\n\n for ind_match in matches:\n if isinstance(ind_match, tuple):\n ind_match = ind_match[0]\n\n if self.is_whitelisted(ind_match, ind_type):\n continue\n\n if ind_type in self.defang:\n ind_match = re.sub(r'\\[\\.\\]', '.', ind_match)\n\n if self.dedup:\n if (ind_type, ind_match) in self.dedup_store:\n continue\n\n self.dedup_store.add((ind_type, ind_match))\n\n self.handler.print_match(fpath, page_num, ind_type, ind_match)", "metadata": "root.IOC_Parser.parse_page", "header": "['class', 'IOC_Parser', '(', 'object', ')', ':', '___EOS___']", "index": 146 }, { "content": " def parse_pdf_pypdf2(self, f, fpath):\n try:\n pdf = PdfFileReader(f, strict = False)\n\n if self.dedup:\n self.dedup_store = set()\n\n self.handler.print_header(fpath)\n page_num = 0\n for page in pdf.pages:\n page_num += 1\n\n data = page.extractText()\n\n self.parse_page(fpath, data, page_num)\n self.handler.print_footer(fpath)\n except (KeyboardInterrupt, SystemExit):\n raise\n except Exception as e:\n self.handler.print_error(fpath, e)", "metadata": "root.IOC_Parser.parse_pdf_pypdf2", "header": "['class', 'IOC_Parser', '(', 'object', ')', ':', '___EOS___']", "index": 168 }, { "content": " def parse_pdf_pdfminer(self, f, fpath):\n try:\n laparams = LAParams()\n laparams.all_texts = True \n rsrcmgr = PDFResourceManager()\n pagenos = set()\n\n if self.dedup:\n self.dedup_store = set()\n\n self.handler.print_header(fpath)\n page_num = 0\n for page in PDFPage.get_pages(f, pagenos, check_extractable=True):\n page_num += 1\n\n retstr = StringIO()\n device = TextConverter(rsrcmgr, retstr, laparams=laparams)\n interpreter = PDFPageInterpreter(rsrcmgr, device)\n interpreter.process_page(page)\n data = retstr.getvalue()\n retstr.close()\n\n self.parse_page(fpath, data, page_num)\n self.handler.print_footer(fpath)\n except (KeyboardInterrupt, SystemExit):\n raise\n except Exception as e:\n self.handler.print_error(fpath, e)", "metadata": "root.IOC_Parser.parse_pdf_pdfminer", "header": "['class', 'IOC_Parser', '(', 'object', ')', ':', '___EOS___']", "index": 189 }, { "content": " def parse_pdf(self, f, fpath):\n parser_format = \"parse_pdf_\" + self.library\n try:\n self.parser_func = getattr(self, parser_format)\n except AttributeError:\n e = 'Selected PDF parser library is not supported: %s' % (self.library)\n raise NotImplementedError(e)\n \n self.parser_func(f, fpath)", "metadata": "root.IOC_Parser.parse_pdf", "header": "['class', 'IOC_Parser', '(', 'object', ')', ':', '___EOS___']", "index": 218 }, { "content": " def parse_txt(self, f, fpath):\n try:\n if self.dedup:\n self.dedup_store = set()\n\n data = f.read()\n self.handler.print_header(fpath)\n self.parse_page(fpath, data, 1)\n self.handler.print_footer(fpath)\n except (KeyboardInterrupt, SystemExit):\n raise\n except Exception as e:\n self.handler.print_error(fpath, e)", "metadata": "root.IOC_Parser.parse_txt", "header": "['class', 'IOC_Parser', '(', 'object', ')', ':', '___EOS___']", "index": 228 }, { "content": " def parse_html(self, f, fpath):\n try:\n if self.dedup:\n self.dedup_store = set()\n \n data = f.read()\n soup = BeautifulSoup(data)\n html = soup.findAll(text=True)\n\n text = u''\n for elem in html:\n if elem.parent.name in ['style', 'script', '[document]', 'head', 'title']:\n continue\n elif re.match('<!--.*-->', unicode(elem)):\n continue\n else:\n text += unicode(elem)\n\n self.handler.print_header(fpath)\n self.parse_page(fpath, text, 1)\n self.handler.print_footer(fpath)\n except (KeyboardInterrupt, SystemExit):\n raise\n except Exception as e:\n self.handler.print_error(fpath, e)", "metadata": "root.IOC_Parser.parse_html", "header": "['class', 'IOC_Parser', '(', 'object', ')', ':', '___EOS___']", "index": 242 }, { "content": " def parse(self, path):\n try:\n if path.startswith('http://') or path.startswith('https://'):\n if 'requests' not in IMPORTS:\n e = 'HTTP library not found: requests'\n raise ImportError(e)\n headers = { 'User-Agent': 'Mozilla/5.0 Gecko Firefox' }\n r = requests.get(path, headers=headers)\n r.raise_for_status()\n f = StringIO(r.content)\n self.parser_func(f, path)\n return\n elif os.path.isfile(path):\n with open(path, 'rb') as f:\n self.parser_func(f, path)\n return\n elif os.path.isdir(path):\n for walk_root, walk_dirs, walk_files in os.walk(path):\n for walk_file in fnmatch.filter(walk_files, self.ext_filter):\n fpath = os.path.join(walk_root, walk_file)\n with open(fpath, 'rb') as f:\n self.parser_func(f, fpath)\n return\n\n e = 'File path is not a file, directory or URL: %s' % (path)\n raise IOError(e)\n except (KeyboardInterrupt, SystemExit):\n raise\n except Exception as e:\n self.handler.print_error(path, e)", "metadata": "root.IOC_Parser.parse", "header": "['class', 'IOC_Parser', '(', 'object', ')', ':', '___EOS___']", "index": 268 } ]
[ { "span": "import sys", "start_line": 38, "start_column": 0, "end_line": 38, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "201", "5", ",", " ", "Arm", "in", " ", "Bu", "esc", "her", " ", "(", "arm", "in", ".", "bu", "esc", "her", "@", "google", "mail", ".", "com", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", " ", "obtain", "ing", " ", "a", " ", "copy_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", " ", "condition", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", " ", "include", "d", " ", "in", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "EXPR", "ESS", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "File", ":", " ", " ", " ", " ", " ", "ioc", "p", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Descripti", "on", ":", " ", " ", "IOC", " ", "Parser", " ", "is", " ", "a", " ", "tool", " ", "to", " ", "extract", " ", "indicat", "ors", " ", "of", " ", "compr", "omi", "se", " ", "from", " ", "security", " ", "reports_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "PD", "F", " ", "format", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "age", ":", " ", " ", " ", " ", "ioc", "p", ".", "py", " ", "[-", "h", "]", " ", "[-", "p", " ", "INI", "]", " ", "[-", "f", " ", "FORMAT", "]", " ", "PDF_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Author", ":", " ", " ", " ", "Arm", "in", " ", "Bu", "esc", "her", " ", "(", "@", "arm", "bu", "es", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Contributor", "s", ":", " ", "Angel", "o", " ", "Del", "l", "'", "Aer", "a", " ", "(", "@", "ange", "lod", "ella", "era", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thanks", " ", "to", ":", " ", " ", " ", " ", "Jos", "e", " ", "Ram", "on", " ", "Pal", "anc", "o_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ko", "en", " ", "Van", " ", "Impe", " ", "(", "@", "cud", "eso", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "fnmatch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "configparser_", "as_", "Config", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "Config", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "option", "al", " ", "third", "-", "part", "y", " ", "libraries_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "IMPORT", "S_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "Py", "PD", "F2_", "import_", "Pd", "f", "File", "Reader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "IMPORT", "S_", "._", "append_", "(_", "'", "pyp", "df", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "pdf", "miner", "_", "._", "pdf", "page_", "import_", "PD", "FP", "age_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pdf", "miner", "_", "._", "pdf", "interp_", "import_", "PD", "FR", "esource", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pdf", "miner", "_", "._", "converter_", "import_", "Text", "Converter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pdf", "miner", "_", "._", "pdf", "interp_", "import_", "PD", "FP", "age", "Interpreter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pdf", "miner", "_", "._", "layout_", "import_", "LA", "Params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "IMPORT", "S_", "._", "append_", "(_", "'", "pdf", "miner", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "bs4_", "import_", "Bea", "uti", "ful", "Soup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "IMPORT", "S_", "._", "append_", "(_", "'", "beautif", "uls", "oup", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "IMPORT", "S_", "._", "append_", "(_", "'", "request", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "addition", "al", " ", "project", " ", "source", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "whitelist_", "import_", "White", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "argparser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argparser_", "._", "add", "\\u", "argument_", "(_", "'", "PATH", "'_", ",_", "action_", "=_", "'", "store", "'_", ",_", "help_", "=_", "'", "File", "/", "director", "y", "/", "URL", " ", "to", " ", "report", "(", "s", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argparser_", "._", "add", "\\u", "argument_", "(_", "'-", "p", "'_", ",_", "dest_", "=_", "'", "INI", "'_", ",_", "default_", "=_", "None_", ",_", "help_", "=_", "'", "Pat", "tern", " ", "file", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argparser_", "._", "add", "\\u", "argument_", "(_", "'-", "i", "'_", ",_", "dest_", "=_", "'", "INPUT", "\\u", "FORMAT", "'_", ",_", "default_", "=_", "'", "pdf", "'_", ",_", "help_", "=_", "'", "Inp", "ut", " ", "format", " ", "(", "pdf", "/", "txt", "/", "html", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argparser_", "._", "add", "\\u", "argument_", "(_", "'-", "o", "'_", ",_", "dest_", "=_", "'", "OUTPU", "T", "\\u", "FORMAT", "'_", ",_", "default_", "=_", "'", "csv", "'_", ",_", "help_", "=_", "'", "Output", " ", "format", " ", "(", "csv", "/", "json", "/", "yar", "a", "/", "netf", "low", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argparser_", "._", "add", "\\u", "argument_", "(_", "'-", "d", "'_", ",_", "dest_", "=_", "'", "DED", "UP", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "default_", "=_", "False_", ",_", "help_", "=_", "'", "Ded", "upli", "cate", " ", "matche", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argparser_", "._", "add", "\\u", "argument_", "(_", "'-", "l", "'_", ",_", "dest_", "=_", "'", "LIB", "'_", ",_", "default_", "=_", "'", "pdf", "miner", "'_", ",_", "help_", "=_", "'", "PD", "F", " ", "pars", "ing", " ", "librar", "y", " ", "(", "pyp", "df", "2", "/", "pdf", "miner", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "argparser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "=_", "IOC", "\\u", "Parser_", "(_", "args_", "._", "INI", "_", ",_", "args_", "._", "INPUT", "\\u", "FORMAT_", ",_", "args_", "._", "DED", "UP_", ",_", "args_", "._", "LIB_", ",_", "args_", "._", "OUTPU", "T", "\\u", "FORMAT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "parse_", "(_", "args_", "._", "PATH_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "IOC", "\\u", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "patterns_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def", "ang_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "IOC", "\\u", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "pattern", "s", "\\u", "ini_", "=_", "None_", ",_", "input", "\\u", "format_", "=_", "'", "pdf", "'_", ",_", "dedup", "_", "=_", "False_", ",_", "library_", "=_", "'", "pdf", "miner", "'_", ",_", "output", "\\u", "format_", "=_", "'", "csv", "'_", ",_", "output", "\\u", "handler_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "basedir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pattern", "s", "\\u", "ini_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pattern", "s", "\\u", "ini_", "=_", "os_", "._", "path_", "._", "join_", "(_", "basedir_", ",_", "'", "pattern", "s", ".", "ini", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "load", "\\u", "patterns_", "(_", "pattern", "s", "\\u", "ini_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "whitelist_", "=_", "White", "List_", "(_", "basedir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dedup", "_", "=_", "dedup", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "output", "\\u", "handler_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "handler_", "=_", "output", "\\u", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "handler_", "=_", "output_", "._", "get", "Handler_", "(_", "output", "\\u", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "ext", "\\u", "filter_", "=_", "\"*", ".\"_", "+_", "input", "\\u", "format_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser", "\\u", "format_", "=_", "\"", "parse", "\\u\"_", "+_", "input", "\\u", "format_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parser", "\\u", "func_", "=_", "getattr_", "(_", "self_", ",_", "parser", "\\u", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e_", "=_", "'", "Select", "ed", " ", "parser", " ", "format", " ", "is", " ", "not", " ", "support", "ed", ":", " ", "%", "s", "'_", "%_", "(_", "input", "\\u", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "library_", "=_", "library_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "input", "\\u", "format_", "==_", "'", "pdf", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "library_", "not_", "in_", "IMPORT", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e_", "=_", "'", "Select", "ed", " ", "PD", "F", " ", "parser", " ", "librar", "y", " ", "not", " ", "found", ":", " ", "%", "s", "'_", "%_", "(_", "library_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Import", "Error_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "input", "\\u", "format_", "==_", "'", "html", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "beautif", "uls", "oup", "'_", "not_", "in_", "IMPORT", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e_", "=_", "'", "HTM", "L", " ", "parser", " ", "librar", "y", " ", "not", " ", "found", ":", " ", "Bea", "uti", "ful", "Sou", "p", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Import", "Error_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IOC", "\\u", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "\\u", "patterns_", "(_", "self_", ",_", "fpath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "=_", "Config", "Parser_", "._", "Config", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "fpath_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "._", "readf", "p_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "ind", "\\u", "type_", "in_", "config_", "._", "sections_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ind", "\\u", "pattern_", "=_", "config_", "._", "get_", "(_", "ind", "\\u", "type_", ",_", "'", "pattern", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ind", "\\u", "pattern_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ind", "\\u", "regex_", "=_", "re_", "._", "compile_", "(_", "ind", "\\u", "pattern_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "patterns_", "[_", "ind", "\\u", "type_", "]_", "=_", "ind", "\\u", "regex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ind", "\\u", "def", "ang_", "=_", "config_", "._", "get_", "(_", "ind", "\\u", "type_", ",_", "'", "def", "ang", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ind", "\\u", "def", "ang_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "def", "ang_", "[_", "ind", "\\u", "type_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IOC", "\\u", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "whitelist", "ed_", "(_", "self_", ",_", "ind", "\\u", "match_", ",_", "ind", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "w_", "in_", "self_", "._", "whitelist_", "[_", "ind", "\\u", "type_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "w_", "._", "findall_", "(_", "ind", "\\u", "match_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IOC", "\\u", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "page_", "(_", "self_", ",_", "fpath_", ",_", "data_", ",_", "page", "\\u", "num_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "ind", "\\u", "type_", ",_", "ind", "\\u", "regex_", "in_", "self_", "._", "patterns_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "matches_", "=_", "ind", "\\u", "regex_", "._", "findall_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "ind", "\\u", "match_", "in_", "matches_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "ind", "\\u", "match_", ",_", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ind", "\\u", "match_", "=_", "ind", "\\u", "match_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "whitelist", "ed_", "(_", "ind", "\\u", "match_", ",_", "ind", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ind", "\\u", "type_", "in_", "self_", "._", "def", "ang_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ind", "\\u", "match_", "=_", "re_", "._", "sub_", "(_", "r", "'\\\\[", "\\\\.\\\\", "]'_", ",_", "'.'_", ",_", "ind", "\\u", "match_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "dedup", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "(_", "ind", "\\u", "type_", ",_", "ind", "\\u", "match_", ")_", "in_", "self_", "._", "dedup", "\\u", "store_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "dedup", "\\u", "store_", "._", "add_", "(_", "(_", "ind", "\\u", "type_", ",_", "ind", "\\u", "match_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "handler_", "._", "print", "\\u", "match_", "(_", "fpath_", ",_", "page", "\\u", "num_", ",_", "ind", "\\u", "type_", ",_", "ind", "\\u", "match_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IOC", "\\u", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "pdf", "\\u", "pyp", "df2_", "(_", "self_", ",_", "f_", ",_", "fpath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pdf_", "=_", "Pd", "f", "File", "Reader_", "(_", "f_", ",_", "strict_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "dedup", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dedup", "\\u", "store_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "handler_", "._", "print", "\\u", "header_", "(_", "fpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "\\u", "num_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "page_", "in_", "pdf_", "._", "pages_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page", "\\u", "num_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "page_", "._", "extract", "Text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parse", "\\u", "page_", "(_", "fpath_", ",_", "data_", ",_", "page", "\\u", "num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "handler_", "._", "print", "\\u", "footer_", "(_", "fpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Key", "board", "Interrupt_", ",_", "System", "Exit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "handler_", "._", "print", "\\u", "error_", "(_", "fpath_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IOC", "\\u", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "pdf", "\\u", "pdf", "miner", "_", "(_", "self_", ",_", "f_", ",_", "fpath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lap", "arams_", "=_", "LA", "Params_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lap", "arams_", "._", "all", "\\u", "texts_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rsrc", "mgr_", "=_", "PD", "FR", "esource", "Manager_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pagen", "os_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "dedup", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dedup", "\\u", "store_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "handler_", "._", "print", "\\u", "header_", "(_", "fpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "\\u", "num_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "page_", "in_", "PD", "FP", "age_", "._", "get", "\\u", "pages_", "(_", "f_", ",_", "pagen", "os_", ",_", "check", "\\u", "extracta", "ble_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page", "\\u", "num_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rets", "tr_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "device_", "=_", "Text", "Converter_", "(_", "rsrc", "mgr_", ",_", "rets", "tr_", ",_", "lap", "arams_", "=_", "lap", "arams_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "interpreter_", "=_", "PD", "FP", "age", "Interpreter_", "(_", "rsrc", "mgr_", ",_", "device_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "interpreter_", "._", "process", "\\u", "page_", "(_", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "rets", "tr_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rets", "tr_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parse", "\\u", "page_", "(_", "fpath_", ",_", "data_", ",_", "page", "\\u", "num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "handler_", "._", "print", "\\u", "footer_", "(_", "fpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Key", "board", "Interrupt_", ",_", "System", "Exit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "handler_", "._", "print", "\\u", "error_", "(_", "fpath_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IOC", "\\u", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "pdf_", "(_", "self_", ",_", "f_", ",_", "fpath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser", "\\u", "format_", "=_", "\"", "parse", "\\u", "pdf", "\\u\"_", "+_", "self_", "._", "library_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parser", "\\u", "func_", "=_", "getattr_", "(_", "self_", ",_", "parser", "\\u", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e_", "=_", "'", "Select", "ed", " ", "PD", "F", " ", "parser", " ", "librar", "y", " ", "is", " ", "not", " ", "support", "ed", ":", " ", "%", "s", "'_", "%_", "(_", "self_", "._", "library_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "parser", "\\u", "func_", "(_", "f_", ",_", "fpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IOC", "\\u", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "txt_", "(_", "self_", ",_", "f_", ",_", "fpath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "dedup", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dedup", "\\u", "store_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "handler_", "._", "print", "\\u", "header_", "(_", "fpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parse", "\\u", "page_", "(_", "fpath_", ",_", "data_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "handler_", "._", "print", "\\u", "footer_", "(_", "fpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Key", "board", "Interrupt_", ",_", "System", "Exit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "handler_", "._", "print", "\\u", "error_", "(_", "fpath_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IOC", "\\u", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "html_", "(_", "self_", ",_", "f_", ",_", "fpath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "dedup", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dedup", "\\u", "store_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "soup_", "=_", "Bea", "uti", "ful", "Soup_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "=_", "soup_", "._", "find", "All_", "(_", "text_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "text_", "=_", "u", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "elem_", "in_", "html_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "elem_", "._", "parent_", "._", "name_", "in_", "[_", "'", "style", "'_", ",_", "'", "script", "'_", ",_", "'[", "document", "]'_", ",_", "'", "head", "'_", ",_", "'", "title", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "re_", "._", "match_", "(_", "'<!", "--", ".*", "-->", "'_", ",_", "unicode_", "(_", "elem_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "text_", "+=_", "unicode_", "(_", "elem_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "handler_", "._", "print", "\\u", "header_", "(_", "fpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parse", "\\u", "page_", "(_", "fpath_", ",_", "text_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "handler_", "._", "print", "\\u", "footer_", "(_", "fpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Key", "board", "Interrupt_", ",_", "System", "Exit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "handler_", "._", "print", "\\u", "error_", "(_", "fpath_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IOC", "\\u", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "path_", "._", "startswith_", "(_", "'", "http", "://'_", ")_", "or_", "path_", "._", "startswith_", "(_", "'", "https", "://'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "request", "s", "'_", "not_", "in_", "IMPORT", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "e_", "=_", "'", "HTTP", " ", "librar", "y", " ", "not", " ", "found", ":", " ", "request", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Import", "Error_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "headers_", "=_", "{_", "'", "User", "-", "Agent", "'_", ":_", "'", "Mo", "zilla", "/", "5.0", " ", "Ge", "cko", " ", "Fire", "fox", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "requests_", "._", "get_", "(_", "path_", ",_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "raise", "\\u", "for", "\\u", "status_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "String", "IO_", "(_", "r_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parser", "\\u", "func_", "(_", "f_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "os_", "._", "path_", "._", "isfile_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "path_", ",_", "'", "rb", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "parser", "\\u", "func_", "(_", "f_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "os_", "._", "path_", "._", "isdir_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "walk", "\\u", "root_", ",_", "walk", "\\u", "dirs_", ",_", "walk", "\\u", "files_", "in_", "os_", "._", "walk_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "walk", "\\u", "file_", "in_", "fnmatch_", "._", "filter_", "(_", "walk", "\\u", "files_", ",_", "self_", "._", "ext", "\\u", "filter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "fpath_", "=_", "os_", "._", "path_", "._", "join_", "(_", "walk", "\\u", "root_", ",_", "walk", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "fpath_", ",_", "'", "rb", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "parser", "\\u", "func_", "(_", "f_", ",_", "fpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "e_", "=_", "'", "File", " ", "path", " ", "is", " ", "not", " ", "a", " ", "file", ",", " ", "director", "y", " ", "or", " ", "URL", ":", " ", "%", "s", "'_", "%_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "IO", "Error_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Key", "board", "Interrupt_", ",_", "System", "Exit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "handler_", "._", "print", "\\u", "error_", "(_", "path_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
benadida/helios-server/helios/views.py
[ { "content": "# -*- coding: utf-8 -*-\n\"\"\"\nHelios Django Views\n\nBen Adida ([email protected])\n\"\"\"\n\nfrom django.core.urlresolvers import reverse\nfrom django.core.mail import send_mail\nfrom django.core.paginator import Paginator\nfrom django.core.exceptions import PermissionDenied\nfrom django.http import *\nfrom django.db import transaction\n\nfrom mimetypes import guess_type\n\nfrom validate_email import validate_email\n\nimport csv, urllib, os, base64\n\nfrom crypto import algs, electionalgs, elgamal\nfrom crypto import utils as cryptoutils\nfrom workflows import homomorphic\nfrom helios import utils as helios_utils\nfrom view_utils import *\n\nfrom helios_auth.security import *\nfrom helios_auth.auth_systems import AUTH_SYSTEMS, can_list_categories\nfrom helios_auth.models import AuthenticationExpired\n\nfrom helios import security\nfrom helios_auth import views as auth_views\n\nimport tasks\n\nfrom security import *\nfrom helios_auth.security import get_user, save_in_session_across_logouts\n\nimport uuid, datetime\n\nfrom models import *\n\nimport forms, signals\n\n# Parameters for everything\nELGAMAL_PARAMS = elgamal.Cryptosystem()\n\n# trying new ones from OlivierP\nELGAMAL_PARAMS.p = 16328632084933010002384055033805457329601614771185955389739167309086214800406465799038583634953752941675645562182498120750264980492381375579367675648771293800310370964745767014243638518442553823973482995267304044326777047662957480269391322789378384619428596446446984694306187644767462460965622580087564339212631775817895958409016676398975671266179637898557687317076177218843233150695157881061257053019133078545928983562221396313169622475509818442661047018436264806901023966236718367204710755935899013750306107738002364137917426595737403871114187750804346564731250609196846638183903982387884578266136503697493474682071L\nELGAMAL_PARAMS.q = 61329566248342901292543872769978950870633559608669337131139375508370458778917L\nELGAMAL_PARAMS.g = 14887492224963187634282421537186040801304008017743492304481737382571933937568724473847106029915040150784031882206090286938661464458896494215273989547889201144857352611058572236578734319505128042602372864570426550855201448111746579871811249114781674309062693442442368697449970648232621880001709535143047913661432883287150003429802392229361583608686643243349727791976247247948618930423866180410558458272606627111270040091203073580238905303994472202930783207472394578498507764703191288249547659899997131166130259700604433891232298182348403175947450284433411265966789131024573629546048637848902243503970966798589660808533L\n\n# object ready for serialization\nELGAMAL_PARAMS_LD_OBJECT = datatypes.LDObject.instantiate(ELGAMAL_PARAMS, datatype='legacy/EGParams')\n\n# single election server? Load the single electionfrom models import Election\nfrom django.conf import settings\n\n\n\n\n\n\n##\n## remote auth utils\n\n\n## \n## simple admin for development\n##\n\n##\n## General election features\n##\n\n\n\n\n\n# a hidden view behind the shortcut that performs the actual perm check\n \n\n \n\n\n\n \n\n \n\n\n\n\n\n\n\n\n\n##\n## Trustees and Public Key\n##\n## As of July 2009, there are always trustees for a Helios election: one trustee is acceptable, for simple elections.\n##\n \n \n\n \n \n\n\n \n \n\n##\n## Ballot Management\n##\n\n\n \n \n\n# we don't require frozen election to allow for ballot preview\n\n\n \n\n\n \n\n\n\n\n\n\n# changed from admin to view because \n# anyone can see the questions, the administration aspect is now\n# built into the page\n\n\n \n\n\n\n\n\n \n\n\n\n \n \n\n \n\n\n\n# Individual Voters\n \n\n\n\n##\n## cast ballots\n##\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def get_election_url(election):\n return settings.URL_HOST + reverse(election_shortcut, args=[election.short_name]) ", "metadata": "root.get_election_url", "header": "['module', '___EOS___']", "index": 58 }, { "content": "def get_election_badge_url(election):\n return settings.URL_HOST + reverse(election_badge, args=[election.uuid]) ", "metadata": "root.get_election_badge_url", "header": "['module', '___EOS___']", "index": 61 }, { "content": "def get_election_govote_url(election):\n return settings.URL_HOST + reverse(election_vote_shortcut, args=[election.short_name]) ", "metadata": "root.get_election_govote_url", "header": "['module', '___EOS___']", "index": 64 }, { "content": "def get_castvote_url(cast_vote):\n return settings.URL_HOST + reverse(castvote_shortcut, args=[cast_vote.vote_tinyhash])", "metadata": "root.get_castvote_url", "header": "['module', '___EOS___']", "index": 67 }, { "content": "def user_reauth(request, user):\n # FIXME: should we be wary of infinite redirects here, and\n # add a parameter to prevent it? Maybe.\n login_url = \"%s%s?%s\" % (settings.SECURE_URL_HOST,\n reverse(auth_views.start, args=[user.user_type]),\n urllib.urlencode({'return_url':\n request.get_full_path()}))\n return HttpResponseRedirect(login_url)", "metadata": "root.user_reauth", "header": "['module', '___EOS___']", "index": 74 }, { "content": "def admin_autologin(request):\n if \"localhost\" not in settings.URL_HOST and \"127.0.0.1\" not in settings.URL_HOST:\n raise Http404\n \n users = User.objects.filter(admin_p=True)\n if len(users) == 0:\n return HttpResponse(\"no admin users!\")\n\n if len(users) == 0:\n return HttpResponse(\"no users!\")\n\n user = users[0]\n request.session['user'] = {'type' : user.user_type, 'user_id' : user.user_id}\n return HttpResponseRedirect(\"/\")", "metadata": "root.admin_autologin", "header": "['module', '___EOS___']", "index": 86 }, { "content": "@return_json\ndef election_params(request):\n return ELGAMAL_PARAMS_LD_OBJECT.toJSONDict()", "metadata": "root.election_params", "header": "['module', '___EOS___']", "index": 105 }, { "content": "def election_verifier(request):\n return render_template(request, \"tally_verifier\")", "metadata": "root.election_verifier", "header": "['module', '___EOS___']", "index": 109 }, { "content": "def election_single_ballot_verifier(request):\n return render_template(request, \"ballot_verifier\")", "metadata": "root.election_single_ballot_verifier", "header": "['module', '___EOS___']", "index": 112 }, { "content": "def election_shortcut(request, election_short_name):\n election = Election.get_by_short_name(election_short_name)\n if election:\n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(one_election_view, args=[election.uuid]))\n else:\n raise Http404", "metadata": "root.election_shortcut", "header": "['module', '___EOS___']", "index": 115 }, { "content": "@election_view()\ndef _election_vote_shortcut(request, election):\n vote_url = \"%s/booth/vote.html?%s\" % (settings.SECURE_URL_HOST, urllib.urlencode({'election_url' : reverse(one_election, args=[election.uuid])}))\n \n test_cookie_url = \"%s?%s\" % (reverse(test_cookie), urllib.urlencode({'continue_url' : vote_url}))\n\n return HttpResponseRedirect(test_cookie_url)", "metadata": "root._election_vote_shortcut", "header": "['module', '___EOS___']", "index": 123 }, { "content": "def election_vote_shortcut(request, election_short_name):\n election = Election.get_by_short_name(election_short_name)\n if election:\n return _election_vote_shortcut(request, election_uuid=election.uuid)\n else:\n raise Http404", "metadata": "root.election_vote_shortcut", "header": "['module', '___EOS___']", "index": 131 }, { "content": "@election_view()\ndef _castvote_shortcut_by_election(request, election, cast_vote):\n return render_template(request, 'castvote', {'cast_vote' : cast_vote, 'vote_content': cast_vote.vote.toJSON(), 'the_voter': cast_vote.voter, 'election': election})", "metadata": "root._castvote_shortcut_by_election", "header": "['module', '___EOS___']", "index": 138 }, { "content": "def castvote_shortcut(request, vote_tinyhash):\n try:\n cast_vote = CastVote.objects.get(vote_tinyhash = vote_tinyhash)\n except CastVote.DoesNotExist:\n raise Http404\n\n return _castvote_shortcut_by_election(request, election_uuid = cast_vote.voter.election.uuid, cast_vote=cast_vote)", "metadata": "root.castvote_shortcut", "header": "['module', '___EOS___']", "index": 142 }, { "content": "@trustee_check\ndef trustee_keygenerator(request, election, trustee):\n \"\"\"\n A key generator with the current params, like the trustee home but without a specific election.\n \"\"\"\n eg_params_json = utils.to_json(ELGAMAL_PARAMS_LD_OBJECT.toJSONDict())\n\n return render_template(request, \"election_keygenerator\", {'eg_params_json': eg_params_json, 'election': election, 'trustee': trustee})", "metadata": "root.trustee_keygenerator", "header": "['module', '___EOS___']", "index": 150 }, { "content": "@login_required\ndef elections_administered(request):\n if not can_create_election(request):\n return HttpResponseForbidden('only an administrator has elections to administer')\n \n user = get_user(request)\n elections = Election.get_by_user_as_admin(user)\n \n return render_template(request, \"elections_administered\", {'elections': elections})", "metadata": "root.elections_administered", "header": "['module', '___EOS___']", "index": 159 }, { "content": "@login_required\ndef elections_voted(request):\n user = get_user(request)\n elections = Election.get_by_user_as_voter(user)\n \n return render_template(request, \"elections_voted\", {'elections': elections})", "metadata": "root.elections_voted", "header": "['module', '___EOS___']", "index": 169 }, { "content": "@login_required\ndef election_new(request):\n if not can_create_election(request):\n return HttpResponseForbidden('only an administrator can create an election')\n \n error = None\n \n user = get_user(request)\n\n if request.method == \"GET\":\n election_form = forms.ElectionForm(initial={'private_p': settings.HELIOS_PRIVATE_DEFAULT,\n 'help_email': user.info.get(\"email\", '')})\n else:\n check_csrf(request)\n election_form = forms.ElectionForm(request.POST)\n \n if election_form.is_valid():\n # create the election obj\n election_params = dict(election_form.cleaned_data)\n \n # is the short name valid\n if helios_utils.urlencode(election_params['short_name']) == election_params['short_name']: \n election_params['uuid'] = str(uuid.uuid1())\n election_params['cast_url'] = settings.SECURE_URL_HOST + reverse(one_election_cast, args=[election_params['uuid']])\n \n # registration starts closed\n election_params['openreg'] = False\n\n user = get_user(request)\n election_params['admin'] = user\n \n election, created_p = Election.get_or_create(**election_params)\n \n if created_p:\n # add Helios as a trustee by default\n election.generate_trustee(ELGAMAL_PARAMS)\n \n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(one_election_view, args=[election.uuid]))\n else:\n error = \"An election with short name %s already exists\" % election_params['short_name']\n else:\n error = \"No special characters allowed in the short name.\"\n \n return render_template(request, \"election_new\", {'election_form': election_form, 'error': error})", "metadata": "root.election_new", "header": "['module', '___EOS___']", "index": 177 }, { "content": "@election_admin(frozen=False)\ndef one_election_edit(request, election):\n\n error = None\n RELEVANT_FIELDS = ['short_name', 'name', 'description', 'use_voter_aliases', 'election_type', 'private_p', 'help_email', 'randomize_answer_order']\n # RELEVANT_FIELDS += ['use_advanced_audit_features']\n\n if settings.ALLOW_ELECTION_INFO_URL:\n RELEVANT_FIELDS += ['election_info_url']\n \n if request.method == \"GET\":\n values = {}\n for attr_name in RELEVANT_FIELDS:\n values[attr_name] = getattr(election, attr_name)\n election_form = forms.ElectionForm(values)\n else:\n check_csrf(request)\n election_form = forms.ElectionForm(request.POST)\n \n if election_form.is_valid():\n clean_data = election_form.cleaned_data\n for attr_name in RELEVANT_FIELDS:\n setattr(election, attr_name, clean_data[attr_name])\n\n election.save()\n \n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(one_election_view, args=[election.uuid]))\n \n return render_template(request, \"election_edit\", {'election_form' : election_form, 'election' : election, 'error': error})", "metadata": "root.one_election_edit", "header": "['module', '___EOS___']", "index": 222 }, { "content": "@election_admin(frozen=False)\ndef one_election_schedule(request, election):\n return HttpResponse(\"foo\")", "metadata": "root.one_election_schedule", "header": "['module', '___EOS___']", "index": 252 }, { "content": "@election_view()\n@return_json\ndef one_election(request, election):\n if not election:\n raise Http404\n return election.toJSONDict(complete=True)", "metadata": "root.one_election", "header": "['module', '___EOS___']", "index": 256 }, { "content": "@election_view()\n@return_json\ndef one_election_meta(request, election):\n if not election:\n raise Http404\n return election.metadata", "metadata": "root.one_election_meta", "header": "['module', '___EOS___']", "index": 263 }, { "content": "@election_view()\ndef election_badge(request, election):\n election_url = get_election_url(election)\n params = {'election': election, 'election_url': election_url}\n for option_name in ['show_title', 'show_vote_link']:\n params[option_name] = (request.GET.get(option_name, '1') == '1')\n return render_template(request, \"election_badge\", params)", "metadata": "root.election_badge", "header": "['module', '___EOS___']", "index": 270 }, { "content": "@election_view()\ndef one_election_view(request, election):\n user = get_user(request)\n admin_p = security.user_can_admin_election(user, election)\n can_feature_p = security.user_can_feature_election(user, election)\n \n notregistered = False\n eligible_p = True\n \n election_url = get_election_url(election)\n election_badge_url = get_election_badge_url(election)\n status_update_message = None\n\n vote_url = \"%s/booth/vote.html?%s\" % (settings.SECURE_URL_HOST, urllib.urlencode({'election_url' : reverse(one_election, args=[election.uuid])}))\n\n test_cookie_url = \"%s?%s\" % (reverse(test_cookie), urllib.urlencode({'continue_url' : vote_url}))\n \n if user:\n voter = Voter.get_by_election_and_user(election, user)\n \n if not voter:\n try:\n eligible_p = _check_eligibility(election, user)\n except AuthenticationExpired:\n return user_reauth(request, user)\n notregistered = True\n else:\n voter = get_voter(request, user, election)\n\n if voter:\n # cast any votes?\n votes = CastVote.get_by_voter(voter)\n else:\n votes = None\n\n # status update message?\n if election.openreg:\n if election.voting_has_started:\n status_update_message = u\"Vote in %s\" % election.name\n else:\n status_update_message = u\"Register to vote in %s\" % election.name\n\n # result!\n if election.result:\n status_update_message = u\"Results are in for %s\" % election.name\n \n trustees = Trustee.get_by_election(election)\n\n # should we show the result?\n show_result = election.result_released_at or (election.result and admin_p)\n\n return render_template(request, 'election_view',\n {'election' : election, 'trustees': trustees, 'admin_p': admin_p, 'user': user,\n 'voter': voter, 'votes': votes, 'notregistered': notregistered, 'eligible_p': eligible_p,\n 'can_feature_p': can_feature_p, 'election_url' : election_url, \n 'vote_url': vote_url, 'election_badge_url' : election_badge_url,\n 'show_result': show_result,\n 'test_cookie_url': test_cookie_url})", "metadata": "root.one_election_view", "header": "['module', '___EOS___']", "index": 278 }, { "content": "def test_cookie(request):\n continue_url = request.GET['continue_url']\n request.session.set_test_cookie()\n next_url = \"%s?%s\" % (reverse(test_cookie_2), urllib.urlencode({'continue_url': continue_url}))\n return HttpResponseRedirect(settings.SECURE_URL_HOST + next_url) ", "metadata": "root.test_cookie", "header": "['module', '___EOS___']", "index": 337 }, { "content": "def test_cookie_2(request):\n continue_url = request.GET['continue_url']\n\n if not request.session.test_cookie_worked():\n return HttpResponseRedirect(settings.SECURE_URL_HOST + (\"%s?%s\" % (reverse(nocookies), urllib.urlencode({'continue_url': continue_url}))))\n\n request.session.delete_test_cookie()\n return HttpResponseRedirect(continue_url) ", "metadata": "root.test_cookie_2", "header": "['module', '___EOS___']", "index": 343 }, { "content": "def nocookies(request):\n retest_url = \"%s?%s\" % (reverse(test_cookie), urllib.urlencode({'continue_url' : request.GET['continue_url']}))\n return render_template(request, 'nocookies', {'retest_url': retest_url})", "metadata": "root.nocookies", "header": "['module', '___EOS___']", "index": 352 }, { "content": "@election_view()\n@return_json\ndef list_trustees(request, election):\n trustees = Trustee.get_by_election(election)\n return [t.toJSONDict(complete=True) for t in trustees]", "metadata": "root.list_trustees", "header": "['module', '___EOS___']", "index": 361 }, { "content": "@election_view()\ndef list_trustees_view(request, election):\n trustees = Trustee.get_by_election(election)\n user = get_user(request)\n admin_p = security.user_can_admin_election(user, election)\n \n return render_template(request, 'list_trustees', {'election': election, 'trustees': trustees, 'admin_p':admin_p})", "metadata": "root.list_trustees_view", "header": "['module', '___EOS___']", "index": 367 }, { "content": "@election_admin(frozen=False)\ndef new_trustee(request, election):\n if request.method == \"GET\":\n return render_template(request, 'new_trustee', {'election' : election})\n else:\n check_csrf(request)\n # get the public key and the hash, and add it\n name = request.POST['name']\n email = request.POST['email']\n \n trustee = Trustee(uuid = str(uuid.uuid1()), election = election, name=name, email=email)\n trustee.save()\n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(list_trustees_view, args=[election.uuid]))", "metadata": "root.new_trustee", "header": "['module', '___EOS___']", "index": 375 }, { "content": "@election_admin(frozen=False)\ndef new_trustee_helios(request, election):\n \"\"\"\n Make Helios a trustee of the election\n \"\"\"\n election.generate_trustee(ELGAMAL_PARAMS)\n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(list_trustees_view, args=[election.uuid]))", "metadata": "root.new_trustee_helios", "header": "['module', '___EOS___']", "index": 389 }, { "content": "@election_admin(frozen=False)\ndef delete_trustee(request, election):\n trustee = Trustee.get_by_election_and_uuid(election, request.GET['uuid'])\n trustee.delete()\n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(list_trustees_view, args=[election.uuid]))", "metadata": "root.delete_trustee", "header": "['module', '___EOS___']", "index": 397 }, { "content": "def trustee_login(request, election_short_name, trustee_email, trustee_secret):\n election = Election.get_by_short_name(election_short_name)\n if election:\n trustee = Trustee.get_by_election_and_email(election, trustee_email)\n \n if trustee:\n if trustee.secret == trustee_secret:\n set_logged_in_trustee(request, trustee)\n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(trustee_home, args=[election.uuid, trustee.uuid]))\n else:\n # bad secret, we'll let that redirect to the front page\n pass\n else:\n # no such trustee\n raise Http404\n\n return HttpResponseRedirect(settings.SECURE_URL_HOST + \"/\")", "metadata": "root.trustee_login", "header": "['module', '___EOS___']", "index": 403 }, { "content": "@election_admin()\ndef trustee_send_url(request, election, trustee_uuid):\n trustee = Trustee.get_by_election_and_uuid(election, trustee_uuid)\n \n url = settings.SECURE_URL_HOST + reverse(trustee_login, args=[election.short_name, trustee.email, trustee.secret])\n \n body = \"\"\"\n\nYou are a trustee for %s.\n\nYour trustee dashboard is at\n\n %s\n \n--\nHelios \n\"\"\" % (election.name, url)\n\n helios_utils.send_email(settings.SERVER_EMAIL, [\"%s <%s>\" % (trustee.name, trustee.email)], 'your trustee homepage for %s' % election.name, body)\n\n logging.info(\"URL %s \" % url)\n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(list_trustees_view, args = [election.uuid]))", "metadata": "root.trustee_send_url", "header": "['module', '___EOS___']", "index": 421 }, { "content": "@trustee_check\ndef trustee_home(request, election, trustee):\n return render_template(request, 'trustee_home', {'election': election, 'trustee':trustee})", "metadata": "root.trustee_home", "header": "['module', '___EOS___']", "index": 444 }, { "content": "@trustee_check\ndef trustee_check_sk(request, election, trustee):\n return render_template(request, 'trustee_check_sk', {'election': election, 'trustee':trustee})", "metadata": "root.trustee_check_sk", "header": "['module', '___EOS___']", "index": 448 }, { "content": "@trustee_check\ndef trustee_upload_pk(request, election, trustee):\n if request.method == \"POST\":\n # get the public key and the hash, and add it\n public_key_and_proof = utils.from_json(request.POST['public_key_json'])\n trustee.public_key = algs.EGPublicKey.fromJSONDict(public_key_and_proof['public_key'])\n trustee.pok = algs.DLogProof.fromJSONDict(public_key_and_proof['pok'])\n \n # verify the pok\n if not trustee.public_key.verify_sk_proof(trustee.pok, algs.DLog_challenge_generator):\n raise Exception(\"bad pok for this public key\")\n \n trustee.public_key_hash = utils.hash_b64(utils.to_json(trustee.public_key.toJSONDict()))\n\n trustee.save()\n \n # send a note to admin\n try:\n election.admin.send_message(\"%s - trustee pk upload\" % election.name, \"trustee %s (%s) uploaded a pk.\" % (trustee.name, trustee.email))\n except:\n # oh well, no message sent\n pass\n \n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(trustee_home, args=[election.uuid, trustee.uuid]))", "metadata": "root.trustee_upload_pk", "header": "['module', '___EOS___']", "index": 452 }, { "content": "@election_view()\n@return_json\ndef get_randomness(request, election):\n \"\"\"\n get some randomness to sprinkle into the sjcl entropy pool\n \"\"\"\n return {\n # back to urandom, it's fine\n \"randomness\" : base64.b64encode(os.urandom(32))\n #\"randomness\" : base64.b64encode(uuid.uuid4().bytes + uuid.uuid4().bytes)\n }", "metadata": "root.get_randomness", "header": "['module', '___EOS___']", "index": 481 }, { "content": "@election_view(frozen=True)\n@return_json\ndef encrypt_ballot(request, election):\n \"\"\"\n perform the ballot encryption given answers_json, a JSON'ified list of list of answers\n (list of list because each question could have a list of answers if more than one.)\n \"\"\"\n # FIXME: maybe make this just request.POST at some point?\n answers = utils.from_json(request.REQUEST['answers_json'])\n ev = homomorphic.EncryptedVote.fromElectionAndAnswers(election, answers)\n return ev.ld_object.includeRandomness().toJSONDict()", "metadata": "root.encrypt_ballot", "header": "['module', '___EOS___']", "index": 493 }, { "content": "@election_view(frozen=True)\ndef post_audited_ballot(request, election):\n if request.method == \"POST\":\n raw_vote = request.POST['audited_ballot']\n encrypted_vote = electionalgs.EncryptedVote.fromJSONDict(utils.from_json(raw_vote))\n vote_hash = encrypted_vote.get_hash()\n audited_ballot = AuditedBallot(raw_vote = raw_vote, vote_hash = vote_hash, election = election)\n audited_ballot.save()\n \n return SUCCESS", "metadata": "root.post_audited_ballot", "header": "['module', '___EOS___']", "index": 505 }, { "content": "@election_view()\ndef one_election_cast(request, election):\n \"\"\"\n on a GET, this is a cancellation, on a POST it's a cast\n \"\"\"\n if request.method == \"GET\":\n return HttpResponseRedirect(\"%s%s\" % (settings.SECURE_URL_HOST, reverse(one_election_view, args = [election.uuid])))\n \n user = get_user(request) \n encrypted_vote = request.POST['encrypted_vote']\n\n save_in_session_across_logouts(request, 'encrypted_vote', encrypted_vote)\n\n return HttpResponseRedirect(\"%s%s\" % (settings.SECURE_URL_HOST, reverse(one_election_cast_confirm, args=[election.uuid])))", "metadata": "root.one_election_cast", "header": "['module', '___EOS___']", "index": 518 }, { "content": "@election_view(allow_logins=True)\ndef password_voter_login(request, election):\n \"\"\"\n This is used to log in as a voter for a particular election\n \"\"\"\n\n # the URL to send the user to after they've logged in\n return_url = request.REQUEST.get('return_url', reverse(one_election_cast_confirm, args=[election.uuid]))\n bad_voter_login = (request.GET.get('bad_voter_login', \"0\") == \"1\")\n\n if request.method == \"GET\":\n # if user logged in somehow in the interim, e.g. using the login link for administration,\n # then go!\n if user_can_see_election(request, election):\n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(one_election_view, args = [election.uuid]))\n\n password_login_form = forms.VoterPasswordForm()\n return render_template(request, 'password_voter_login',\n {'election': election, \n 'return_url' : return_url,\n 'password_login_form': password_login_form,\n 'bad_voter_login' : bad_voter_login})\n \n login_url = request.REQUEST.get('login_url', None)\n\n if not login_url:\n # login depending on whether this is a private election\n # cause if it's private the login is happening on the front page\n if election.private_p:\n login_url = reverse(password_voter_login, args=[election.uuid])\n else:\n login_url = reverse(one_election_cast_confirm, args=[election.uuid])\n\n password_login_form = forms.VoterPasswordForm(request.POST)\n\n if password_login_form.is_valid():\n try:\n voter = election.voter_set.get(voter_login_id = password_login_form.cleaned_data['voter_id'].strip(),\n voter_password = password_login_form.cleaned_data['password'].strip())\n\n request.session['CURRENT_VOTER_ID'] = voter.id\n\n # if we're asked to cast, let's do it\n if request.POST.get('cast_ballot') == \"1\":\n return one_election_cast_confirm(request, election.uuid)\n \n except Voter.DoesNotExist:\n redirect_url = login_url + \"?\" + urllib.urlencode({\n 'bad_voter_login' : '1',\n 'return_url' : return_url\n })\n\n return HttpResponseRedirect(settings.SECURE_URL_HOST + redirect_url)\n \n return HttpResponseRedirect(settings.SECURE_URL_HOST + return_url)", "metadata": "root.password_voter_login", "header": "['module', '___EOS___']", "index": 533 }, { "content": "@election_view()\ndef one_election_cast_confirm(request, election):\n user = get_user(request) \n\n # if no encrypted vote, the user is reloading this page or otherwise getting here in a bad way\n if not request.session.has_key('encrypted_vote'):\n return HttpResponseRedirect(settings.URL_HOST)\n\n # election not frozen or started\n if not election.voting_has_started():\n return render_template(request, 'election_not_started', {'election': election})\n\n voter = get_voter(request, user, election)\n\n # auto-register this person if the election is openreg\n if user and not voter and election.openreg:\n voter = _register_voter(election, user)\n \n # tallied election, no vote casting\n if election.encrypted_tally or election.result:\n return render_template(request, 'election_tallied', {'election': election})\n \n encrypted_vote = request.session['encrypted_vote']\n vote_fingerprint = cryptoutils.hash_b64(encrypted_vote)\n\n # if this user is a voter, prepare some stuff\n if voter:\n vote = datatypes.LDObject.fromDict(utils.from_json(encrypted_vote), type_hint='legacy/EncryptedVote').wrapped_obj\n\n # prepare the vote to cast\n cast_vote_params = {\n 'vote' : vote,\n 'voter' : voter,\n 'vote_hash': vote_fingerprint,\n 'cast_at': datetime.datetime.utcnow()\n }\n\n cast_vote = CastVote(**cast_vote_params)\n else:\n cast_vote = None\n \n if request.method == \"GET\":\n if voter:\n past_votes = CastVote.get_by_voter(voter)\n if len(past_votes) == 0:\n past_votes = None\n else:\n past_votes = None\n\n if cast_vote:\n # check for issues\n issues = cast_vote.issues(election)\n else:\n issues = None\n\n bad_voter_login = (request.GET.get('bad_voter_login', \"0\") == \"1\")\n\n # status update this vote\n if voter and voter.user.can_update_status():\n status_update_label = voter.user.update_status_template() % \"your smart ballot tracker\"\n status_update_message = \"I voted in %s - my smart tracker is %s.. #heliosvoting\" % (get_election_url(election),cast_vote.vote_hash[:10])\n else:\n status_update_label = None\n status_update_message = None\n\n # do we need to constrain the auth_systems?\n if election.eligibility:\n auth_systems = [e['auth_system'] for e in election.eligibility]\n else:\n auth_systems = None\n\n password_only = False\n\n if auth_systems == None or 'password' in auth_systems:\n show_password = True\n password_login_form = forms.VoterPasswordForm()\n\n if auth_systems == ['password']:\n password_only = True\n else:\n show_password = False\n password_login_form = None\n\n return_url = reverse(one_election_cast_confirm, args=[election.uuid])\n login_box = auth_views.login_box_raw(request, return_url=return_url, auth_systems = auth_systems)\n\n return render_template(request, 'election_cast_confirm', {\n 'login_box': login_box, 'election' : election, 'vote_fingerprint': vote_fingerprint,\n 'past_votes': past_votes, 'issues': issues, 'voter' : voter,\n 'return_url': return_url,\n 'status_update_label': status_update_label, 'status_update_message': status_update_message,\n 'show_password': show_password, 'password_only': password_only, 'password_login_form': password_login_form,\n 'bad_voter_login': bad_voter_login})\n \n if request.method == \"POST\":\n check_csrf(request)\n \n # voting has not started or has ended\n if (not election.voting_has_started()) or election.voting_has_stopped():\n return HttpResponseRedirect(settings.URL_HOST)\n \n # if user is not logged in\n # bring back to the confirmation page to let him know\n if not voter:\n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(one_election_cast_confirm, args=[election.uuid]))\n \n # don't store the vote in the voter's data structure until verification\n cast_vote.save()\n\n # status update?\n if request.POST.get('status_update', False):\n status_update_message = request.POST.get('status_update_message')\n else:\n status_update_message = None\n\n # launch the verification task\n tasks.cast_vote_verify_and_store.delay(\n cast_vote_id = cast_vote.id,\n status_update_message = status_update_message)\n \n # remove the vote from the store\n del request.session['encrypted_vote']\n \n return HttpResponseRedirect(\"%s%s\" % (settings.URL_HOST, reverse(one_election_cast_done, args=[election.uuid])))", "metadata": "root.one_election_cast_confirm", "header": "['module', '___EOS___']", "index": 589 }, { "content": "@election_view()\ndef one_election_cast_done(request, election):\n \"\"\"\n This view needs to be loaded because of the IFRAME, but then this causes \n problems if someone clicks \"reload\". So we need a strategy.\n We store the ballot hash in the session\n \"\"\"\n user = get_user(request)\n voter = get_voter(request, user, election)\n\n if voter:\n votes = CastVote.get_by_voter(voter)\n vote_hash = votes[0].vote_hash\n cv_url = get_castvote_url(votes[0])\n\n # only log out if the setting says so *and* we're dealing\n # with a site-wide voter. Definitely remove current_voter\n if voter.user == user:\n logout = settings.LOGOUT_ON_CONFIRMATION\n else:\n logout = False\n del request.session['CURRENT_VOTER_ID']\n\n save_in_session_across_logouts(request, 'last_vote_hash', vote_hash)\n save_in_session_across_logouts(request, 'last_vote_cv_url', cv_url)\n else:\n vote_hash = request.session['last_vote_hash']\n cv_url = request.session['last_vote_cv_url']\n logout = False\n \n # local logout ensures that there's no more\n # user locally\n # WHY DO WE COMMENT THIS OUT? because we want to force a full logout via the iframe, including\n # from remote systems, just in case, i.e. CAS\n # if logout:\n # auth_views.do_local_logout(request)\n \n # remote logout is happening asynchronously in an iframe to be modular given the logout mechanism\n # include_user is set to False if logout is happening\n return render_template(request, 'cast_done', {'election': election,\n 'vote_hash': vote_hash, 'logout': logout},\n include_user=(not logout))", "metadata": "root.one_election_cast_done", "header": "['module', '___EOS___']", "index": 714 }, { "content": "@election_view()\n@return_json\ndef one_election_result(request, election):\n if not election.result_released_at:\n raise PermissionDenied\n return election.result", "metadata": "root.one_election_result", "header": "['module', '___EOS___']", "index": 757 }, { "content": "@election_view()\n@return_json\ndef one_election_result_proof(request, election):\n if not election.result_released_at:\n raise PermissionDenied\n return election.result_proof", "metadata": "root.one_election_result_proof", "header": "['module', '___EOS___']", "index": 764 }, { "content": "@election_view(frozen=True)\ndef one_election_bboard(request, election):\n \"\"\"\n UI to show election bboard\n \"\"\"\n after = request.GET.get('after', None)\n offset= int(request.GET.get('offset', 0))\n limit = int(request.GET.get('limit', 50))\n \n order_by = 'voter_id'\n \n # unless it's by alias, in which case we better go by UUID\n if election.use_voter_aliases:\n order_by = 'alias'\n\n # if there's a specific voter\n if request.GET.has_key('q'):\n # FIXME: figure out the voter by voter_id\n voters = []\n else:\n # load a bunch of voters\n voters = Voter.get_by_election(election, after=after, limit=limit+1, order_by=order_by)\n \n more_p = len(voters) > limit\n if more_p:\n voters = voters[0:limit]\n next_after = getattr(voters[limit-1], order_by)\n else:\n next_after = None\n \n return render_template(request, 'election_bboard', {'election': election, 'voters': voters, 'next_after': next_after,\n 'offset': offset, 'limit': limit, 'offset_plus_one': offset+1, 'offset_plus_limit': offset+limit,\n 'voter_id': request.GET.get('voter_id', '')})", "metadata": "root.one_election_bboard", "header": "['module', '___EOS___']", "index": 771 }, { "content": "@election_view(frozen=True)\ndef one_election_audited_ballots(request, election):\n \"\"\"\n UI to show election audited ballots\n \"\"\"\n \n if request.GET.has_key('vote_hash'):\n b = AuditedBallot.get(election, request.GET['vote_hash'])\n return HttpResponse(b.raw_vote, mimetype=\"text/plain\")\n \n after = request.GET.get('after', None)\n offset= int(request.GET.get('offset', 0))\n limit = int(request.GET.get('limit', 50))\n \n audited_ballots = AuditedBallot.get_by_election(election, after=after, limit=limit+1)\n \n more_p = len(audited_ballots) > limit\n if more_p:\n audited_ballots = audited_ballots[0:limit]\n next_after = audited_ballots[limit-1].vote_hash\n else:\n next_after = None\n \n return render_template(request, 'election_audited_ballots', {'election': election, 'audited_ballots': audited_ballots, 'next_after': next_after,\n 'offset': offset, 'limit': limit, 'offset_plus_one': offset+1, 'offset_plus_limit': offset+limit})", "metadata": "root.one_election_audited_ballots", "header": "['module', '___EOS___']", "index": 805 }, { "content": "@election_admin()\ndef voter_delete(request, election, voter_uuid):\n \"\"\"\n Two conditions under which a voter can be deleted:\n - election is not frozen or\n - election is open reg\n \"\"\"\n ## FOR NOW we allow this to see if we can redefine the meaning of \"closed reg\" to be more flexible\n # if election is frozen and has closed registration\n #if election.frozen_at and (not election.openreg):\n # raise PermissionDenied()\n\n if election.encrypted_tally:\n raise PermissionDenied()\n\n voter = Voter.get_by_election_and_uuid(election, voter_uuid)\n if voter:\n voter.delete()\n\n if election.frozen_at:\n # log it\n election.append_log(\"Voter %s/%s removed after election frozen\" % (voter.voter_type,voter.voter_id))\n \n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(voters_list_pretty, args=[election.uuid]))", "metadata": "root.voter_delete", "header": "['module', '___EOS___']", "index": 831 }, { "content": "@election_admin(frozen=False)\ndef one_election_set_reg(request, election):\n \"\"\"\n Set whether this is open registration or not\n \"\"\"\n # only allow this for public elections\n if not election.private_p:\n open_p = bool(int(request.GET['open_p']))\n election.openreg = open_p\n election.save()\n \n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(voters_list_pretty, args=[election.uuid]))", "metadata": "root.one_election_set_reg", "header": "['module', '___EOS___']", "index": 856 }, { "content": "@election_admin()\ndef one_election_set_featured(request, election):\n \"\"\"\n Set whether this is a featured election or not\n \"\"\"\n\n user = get_user(request)\n if not security.user_can_feature_election(user, election):\n raise PermissionDenied()\n\n featured_p = bool(int(request.GET['featured_p']))\n election.featured_p = featured_p\n election.save()\n \n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(one_election_view, args=[election.uuid]))", "metadata": "root.one_election_set_featured", "header": "['module', '___EOS___']", "index": 869 }, { "content": "@election_admin()\ndef one_election_archive(request, election):\n \n archive_p = request.GET.get('archive_p', True)\n \n if bool(int(archive_p)):\n election.archived_at = datetime.datetime.utcnow()\n else:\n election.archived_at = None\n \n election.save()\n\n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(one_election_view, args=[election.uuid]))", "metadata": "root.one_election_archive", "header": "['module', '___EOS___']", "index": 885 }, { "content": "@election_view()\ndef one_election_questions(request, election):\n questions_json = utils.to_json(election.questions)\n user = get_user(request)\n admin_p = security.user_can_admin_election(user, election)\n\n return render_template(request, 'election_questions', {'election': election, 'questions_json' : questions_json, 'admin_p': admin_p})", "metadata": "root.one_election_questions", "header": "['module', '___EOS___']", "index": 902 }, { "content": "def _check_eligibility(election, user):\n # prevent password-users from signing up willy-nilly for other elections, doesn't make sense\n if user.user_type == 'password':\n return False\n\n return election.user_eligible_p(user)", "metadata": "root._check_eligibility", "header": "['module', '___EOS___']", "index": 910 }, { "content": "def _register_voter(election, user):\n if not _check_eligibility(election, user):\n return None\n \n return Voter.register_user_in_election(user, election)", "metadata": "root._register_voter", "header": "['module', '___EOS___']", "index": 917 }, { "content": "@election_view()\ndef one_election_register(request, election):\n if not election.openreg:\n return HttpResponseForbidden('registration is closed for this election')\n \n check_csrf(request)\n \n user = get_user(request)\n voter = Voter.get_by_election_and_user(election, user)\n \n if not voter:\n voter = _register_voter(election, user)\n \n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(one_election_view, args=[election.uuid]))", "metadata": "root.one_election_register", "header": "['module', '___EOS___']", "index": 923 }, { "content": "@election_admin(frozen=False)\ndef one_election_save_questions(request, election):\n check_csrf(request)\n \n election.questions = utils.from_json(request.POST['questions_json'])\n election.save()\n\n # always a machine API\n return SUCCESS", "metadata": "root.one_election_save_questions", "header": "['module', '___EOS___']", "index": 938 }, { "content": "@transaction.atomic\n@election_admin(frozen=False)\ndef one_election_freeze(request, election):\n # figure out the number of questions and trustees\n issues = election.issues_before_freeze\n\n if request.method == \"GET\":\n return render_template(request, 'election_freeze', {'election': election, 'issues' : issues, 'issues_p' : len(issues) > 0})\n else:\n check_csrf(request)\n \n election.freeze()\n\n if get_user(request):\n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(one_election_view, args=[election.uuid]))\n else:\n return SUCCESS ", "metadata": "root.one_election_freeze", "header": "['module', '___EOS___']", "index": 948 }, { "content": "def _check_election_tally_type(election):\n for q in election.questions:\n if q['tally_type'] != \"homomorphic\":\n return False\n return True", "metadata": "root._check_election_tally_type", "header": "['module', '___EOS___']", "index": 966 }, { "content": "@election_admin(frozen=True)\ndef one_election_compute_tally(request, election):\n \"\"\"\n tallying is done all at a time now\n \"\"\"\n if not _check_election_tally_type(election):\n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(one_election_view,args=[election.election_id]))\n\n if request.method == \"GET\":\n return render_template(request, 'election_compute_tally', {'election': election})\n \n check_csrf(request)\n\n if not election.voting_ended_at:\n election.voting_ended_at = datetime.datetime.utcnow()\n\n election.tallying_started_at = datetime.datetime.utcnow()\n election.save()\n\n tasks.election_compute_tally.delay(election_id = election.id)\n\n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(one_election_view,args=[election.uuid]))", "metadata": "root.one_election_compute_tally", "header": "['module', '___EOS___']", "index": 972 }, { "content": "@trustee_check\ndef trustee_decrypt_and_prove(request, election, trustee):\n if not _check_election_tally_type(election) or election.encrypted_tally == None:\n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(one_election_view,args=[election.uuid]))\n \n return render_template(request, 'trustee_decrypt_and_prove', {'election': election, 'trustee': trustee})", "metadata": "root.trustee_decrypt_and_prove", "header": "['module', '___EOS___']", "index": 995 }, { "content": "@election_view(frozen=True)\ndef trustee_upload_decryption(request, election, trustee_uuid):\n if not _check_election_tally_type(election) or election.encrypted_tally == None:\n return FAILURE\n\n trustee = Trustee.get_by_election_and_uuid(election, trustee_uuid)\n\n factors_and_proofs = utils.from_json(request.POST['factors_and_proofs'])\n\n # verify the decryption factors\n trustee.decryption_factors = [[datatypes.LDObject.fromDict(factor, type_hint='core/BigInteger').wrapped_obj for factor in one_q_factors] for one_q_factors in factors_and_proofs['decryption_factors']]\n\n # each proof needs to be deserialized\n trustee.decryption_proofs = [[datatypes.LDObject.fromDict(proof, type_hint='legacy/EGZKProof').wrapped_obj for proof in one_q_proofs] for one_q_proofs in factors_and_proofs['decryption_proofs']]\n\n if trustee.verify_decryption_proofs():\n trustee.save()\n \n try:\n # send a note to admin\n election.admin.send_message(\"%s - trustee partial decryption\" % election.name, \"trustee %s (%s) did their partial decryption.\" % (trustee.name, trustee.email))\n except:\n # ah well\n pass\n \n return SUCCESS\n else:\n return FAILURE", "metadata": "root.trustee_upload_decryption", "header": "['module', '___EOS___']", "index": 1002 }, { "content": "@election_admin(frozen=True)\ndef release_result(request, election):\n \"\"\"\n result is computed and now it's time to release the result\n \"\"\"\n election_url = get_election_url(election)\n\n if request.method == \"POST\":\n check_csrf(request)\n\n election.release_result()\n election.save()\n\n return HttpResponseRedirect(\"%s\" % (settings.SECURE_URL_HOST + reverse(one_election_view, args=[election.uuid])))\n\n # if just viewing the form or the form is not valid\n return render_template(request, 'release_result', {'election': election})", "metadata": "root.release_result", "header": "['module', '___EOS___']", "index": 1031 }, { "content": "@election_admin(frozen=True)\ndef combine_decryptions(request, election):\n \"\"\"\n combine trustee decryptions\n \"\"\"\n\n election_url = get_election_url(election)\n\n if request.method == \"POST\":\n check_csrf(request)\n\n election.combine_decryptions()\n election.save()\n\n return HttpResponseRedirect(\"%s\" % (settings.SECURE_URL_HOST + reverse(one_election_view, args=[election.uuid])))\n\n # if just viewing the form or the form is not valid\n return render_template(request, 'combine_decryptions', {'election': election})", "metadata": "root.combine_decryptions", "header": "['module', '___EOS___']", "index": 1049 }, { "content": "@election_admin(frozen=True)\ndef one_election_set_result_and_proof(request, election):\n if election.tally_type != \"homomorphic\" or election.encrypted_tally == None:\n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(one_election_view,args=[election.election_id]))\n\n # FIXME: check csrf\n \n election.result = utils.from_json(request.POST['result'])\n election.result_proof = utils.from_json(request.POST['result_proof'])\n election.save()\n\n if get_user(request):\n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(one_election_view, args=[election.uuid]))\n else:\n return SUCCESS", "metadata": "root.one_election_set_result_and_proof", "header": "['module', '___EOS___']", "index": 1068 }, { "content": "@election_view()\ndef voters_list_pretty(request, election):\n \"\"\"\n Show the list of voters\n now using Django pagination\n \"\"\"\n\n # for django pagination support\n page = int(request.GET.get('page', 1))\n limit = int(request.GET.get('limit', 50))\n q = request.GET.get('q','')\n \n order_by = 'user__user_id'\n\n # unless it's by alias, in which case we better go by UUID\n if election.use_voter_aliases:\n order_by = 'alias'\n\n user = get_user(request)\n admin_p = security.user_can_admin_election(user, election)\n\n categories = None\n eligibility_category_id = None\n\n try:\n if admin_p and can_list_categories(user.user_type):\n categories = AUTH_SYSTEMS[user.user_type].list_categories(user)\n eligibility_category_id = election.eligibility_category_id(user.user_type)\n except AuthenticationExpired:\n return user_reauth(request, user)\n \n # files being processed\n voter_files = election.voterfile_set.all()\n\n # load a bunch of voters\n # voters = Voter.get_by_election(election, order_by=order_by)\n voters = Voter.objects.filter(election = election).order_by(order_by).defer('vote')\n\n if q != '':\n if election.use_voter_aliases:\n voters = voters.filter(alias__icontains = q)\n else:\n voters = voters.filter(voter_name__icontains = q)\n\n voter_paginator = Paginator(voters, limit)\n voters_page = voter_paginator.page(page)\n\n total_voters = voter_paginator.count\n \n return render_template(request, 'voters_list', \n {'election': election, 'voters_page': voters_page,\n 'voters': voters_page.object_list, 'admin_p': admin_p, \n 'email_voters': helios.VOTERS_EMAIL,\n 'limit': limit, 'total_voters': total_voters,\n 'upload_p': helios.VOTERS_UPLOAD, 'q' : q,\n 'voter_files': voter_files,\n 'categories': categories,\n 'eligibility_category_id' : eligibility_category_id})", "metadata": "root.voters_list_pretty", "header": "['module', '___EOS___']", "index": 1085 }, { "content": "@election_admin()\ndef voters_eligibility(request, election):\n \"\"\"\n set eligibility for voters\n \"\"\"\n user = get_user(request)\n\n if request.method == \"GET\":\n # this shouldn't happen, only POSTs\n return HttpResponseRedirect(\"/\")\n\n # for now, private elections cannot change eligibility\n if election.private_p:\n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(voters_list_pretty, args=[election.uuid]))\n\n # eligibility\n eligibility = request.POST['eligibility']\n\n if eligibility in ['openreg', 'limitedreg']:\n election.openreg= True\n\n if eligibility == 'closedreg':\n election.openreg= False\n\n if eligibility == 'limitedreg':\n # now process the constraint\n category_id = request.POST['category_id']\n\n constraint = AUTH_SYSTEMS[user.user_type].generate_constraint(category_id, user)\n election.eligibility = [{'auth_system': user.user_type, 'constraint': [constraint]}]\n else:\n election.eligibility = None\n\n election.save()\n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(voters_list_pretty, args=[election.uuid]))", "metadata": "root.voters_eligibility", "header": "['module', '___EOS___']", "index": 1144 }, { "content": "@election_admin()\ndef voters_upload(request, election):\n \"\"\"\n Upload a CSV of password-based voters with\n voter_id, email, name\n \n name and email are needed only if voter_type is static\n \"\"\"\n\n ## TRYING this: allowing voters upload by admin when election is frozen\n #if election.frozen_at and not election.openreg:\n # raise PermissionDenied()\n\n if request.method == \"GET\":\n return render_template(request, 'voters_upload', {'election': election, 'error': request.GET.get('e',None)})\n \n if request.method == \"POST\":\n if bool(request.POST.get('confirm_p', 0)):\n # launch the background task to parse that file\n tasks.voter_file_process.delay(voter_file_id = request.session['voter_file_id'])\n del request.session['voter_file_id']\n\n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(voters_list_pretty, args=[election.uuid]))\n else:\n # we need to confirm\n if request.FILES.has_key('voters_file'):\n voters_file = request.FILES['voters_file']\n voter_file_obj = election.add_voters_file(voters_file)\n\n request.session['voter_file_id'] = voter_file_obj.id\n\n problems = []\n\n # import the first few lines to check\n try:\n voters = [v for v in voter_file_obj.itervoters()][:5]\n except:\n voters = []\n problems.append(\"your CSV file could not be processed. Please check that it is a proper CSV file.\")\n\n # check if voter emails look like emails\n if False in [validate_email(v['email']) for v in voters]:\n problems.append(\"those don't look like correct email addresses. Are you sure you uploaded a file with email address as second field?\")\n\n return render_template(request, 'voters_upload_confirm', {'election': election, 'voters': voters, 'problems': problems})\n else:\n return HttpResponseRedirect(\"%s?%s\" % (settings.SECURE_URL_HOST + reverse(voters_upload, args=[election.uuid]), urllib.urlencode({'e':'no voter file specified, try again'})))", "metadata": "root.voters_upload", "header": "['module', '___EOS___']", "index": 1180 }, { "content": "@election_admin()\ndef voters_upload_cancel(request, election):\n \"\"\"\n cancel upload of CSV file\n \"\"\"\n voter_file_id = request.session.get('voter_file_id', None)\n if voter_file_id:\n vf = VoterFile.objects.get(id = voter_file_id)\n vf.delete()\n del request.session['voter_file_id']\n\n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(one_election_view, args=[election.uuid]))", "metadata": "root.voters_upload_cancel", "header": "['module', '___EOS___']", "index": 1228 }, { "content": "@election_admin(frozen=True)\ndef voters_email(request, election):\n if not helios.VOTERS_EMAIL:\n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(one_election_view, args=[election.uuid]))\n TEMPLATES = [\n ('vote', 'Time to Vote'),\n ('simple', 'Simple'),\n ('info', 'Additional Info'),\n ('result', 'Election Result')\n ]\n\n template = request.REQUEST.get('template', 'vote')\n if not template in [t[0] for t in TEMPLATES]:\n raise Exception(\"bad template\")\n\n voter_id = request.REQUEST.get('voter_id', None)\n\n if voter_id:\n voter = Voter.get_by_election_and_voter_id(election, voter_id)\n else:\n voter = None\n \n election_url = get_election_url(election)\n election_vote_url = get_election_govote_url(election)\n\n default_subject = render_template_raw(None, 'email/%s_subject.txt' % template, {\n 'custom_subject': \"&lt;SUBJECT&gt;\"\n})\n default_body = render_template_raw(None, 'email/%s_body.txt' % template, {\n 'election' : election,\n 'election_url' : election_url,\n 'election_vote_url' : election_vote_url,\n 'custom_subject' : default_subject,\n 'custom_message': '&lt;BODY&gt;',\n 'voter': {'vote_hash' : '<SMART_TRACKER>',\n 'name': '<VOTER_NAME>',\n 'voter_login_id': '<VOTER_LOGIN_ID>',\n 'voter_password': '<VOTER_PASSWORD>',\n 'voter_type' : election.voter_set.all()[0].voter_type,\n 'election' : election}\n })\n\n if request.method == \"GET\":\n email_form = forms.EmailVotersForm()\n if voter:\n email_form.fields['send_to'].widget = email_form.fields['send_to'].hidden_widget()\n else:\n email_form = forms.EmailVotersForm(request.POST)\n \n if email_form.is_valid():\n \n # the client knows to submit only once with a specific voter_id\n subject_template = 'email/%s_subject.txt' % template\n body_template = 'email/%s_body.txt' % template\n\n extra_vars = {\n 'custom_subject' : email_form.cleaned_data['subject'],\n 'custom_message' : email_form.cleaned_data['body'],\n 'election_vote_url' : election_vote_url,\n 'election_url' : election_url,\n 'election' : election\n }\n \n voter_constraints_include = None\n voter_constraints_exclude = None\n\n if voter:\n tasks.single_voter_email.delay(voter_uuid = voter.uuid, subject_template = subject_template, body_template = body_template, extra_vars = extra_vars)\n else:\n # exclude those who have not voted\n if email_form.cleaned_data['send_to'] == 'voted':\n voter_constraints_exclude = {'vote_hash' : None}\n \n # include only those who have not voted\n if email_form.cleaned_data['send_to'] == 'not-voted':\n voter_constraints_include = {'vote_hash': None}\n\n tasks.voters_email.delay(election_id = election.id, subject_template = subject_template, body_template = body_template, extra_vars = extra_vars, voter_constraints_include = voter_constraints_include, voter_constraints_exclude = voter_constraints_exclude)\n\n # this batch process is all async, so we can return a nice note\n return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(one_election_view, args=[election.uuid]))\n \n return render_template(request, \"voters_email\", {\n 'email_form': email_form, 'election': election,\n 'voter': voter,\n 'default_subject': default_subject,\n 'default_body' : default_body,\n 'template' : template,\n 'templates' : TEMPLATES}) ", "metadata": "root.voters_email", "header": "['module', '___EOS___']", "index": 1241 }, { "content": "@election_view()\n@return_json\ndef voter_list(request, election):\n # normalize limit\n limit = int(request.GET.get('limit', 500))\n if limit > 500: limit = 500\n \n voters = Voter.get_by_election(election, order_by='uuid', after=request.GET.get('after',None), limit= limit)\n return [v.ld_object.toDict() for v in voters]", "metadata": "root.voter_list", "header": "['module', '___EOS___']", "index": 1332 }, { "content": "@election_view()\n@return_json\ndef one_voter(request, election, voter_uuid):\n \"\"\"\n View a single voter's info as JSON.\n \"\"\"\n voter = Voter.get_by_election_and_uuid(election, voter_uuid)\n if not voter:\n raise Http404\n return voter.toJSONDict() ", "metadata": "root.one_voter", "header": "['module', '___EOS___']", "index": 1342 }, { "content": "@election_view()\n@return_json\ndef voter_votes(request, election, voter_uuid):\n \"\"\"\n all cast votes by a voter\n \"\"\"\n voter = Voter.get_by_election_and_uuid(election, voter_uuid)\n votes = CastVote.get_by_voter(voter)\n return [v.toJSONDict() for v in votes]", "metadata": "root.voter_votes", "header": "['module', '___EOS___']", "index": 1353 }, { "content": "@election_view()\n@return_json\ndef voter_last_vote(request, election, voter_uuid):\n \"\"\"\n all cast votes by a voter\n \"\"\"\n voter = Voter.get_by_election_and_uuid(election, voter_uuid)\n return voter.last_cast_vote().toJSONDict()", "metadata": "root.voter_last_vote", "header": "['module', '___EOS___']", "index": 1363 }, { "content": "@election_view()\n@return_json\ndef ballot_list(request, election):\n \"\"\"\n this will order the ballots from most recent to oldest.\n and optionally take a after parameter.\n \"\"\"\n limit = after = None\n if request.GET.has_key('limit'):\n limit = int(request.GET['limit'])\n if request.GET.has_key('after'):\n after = datetime.datetime.strptime(request.GET['after'], '%Y-%m-%d %H:%M:%S')\n \n voters = Voter.get_by_election(election, cast=True, order_by='cast_at', limit=limit, after=after)\n\n # we explicitly cast this to a short cast vote\n return [v.last_cast_vote().ld_object.short.toDict(complete=True) for v in voters]", "metadata": "root.ballot_list", "header": "['module', '___EOS___']", "index": 1376 } ]
[ { "span": "from django.core.mail import send_mail", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 38 }, { "span": "from mimetypes import guess_type", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 32 }, { "span": "import csv, urllib, os, base64", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 30 }, { "span": "import forms, signals", "start_line": 42, "start_column": 0, "end_line": 42, "end_column": 21 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Heli", "os", " ", "Dj", "ang", "o", " ", "View", "s", "\\", "10", ";", "\\", "10", ";", "Ben", " ", "Adi", "da", " ", "(", "ben", "@", "adi", "da", ".", "net", ")", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "mail_", "import_", "send", "\\u", "mail_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "paginator_", "import_", "Paginator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Permi", "ssion", "Denied_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "transaction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "mimetypes_", "import_", "guess", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "validat", "e\\u", "email_", "import_", "validat", "e\\u", "email_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "csv_", ",_", "urllib_", ",_", "os_", ",_", "base64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "crypto_", "import_", "alg", "s_", ",_", "election", "alg", "s_", ",_", "el", "gam", "al_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "crypto_", "import_", "utils_", "as_", "crypto", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "workflows_", "import_", "homo", "morphi", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "heli", "os_", "import_", "utils_", "as_", "heli", "os", "\\u", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "\\u", "utils_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "heli", "os", "\\u", "auth_", "._", "security_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "heli", "os", "\\u", "auth_", "._", "auth", "\\u", "systems_", "import_", "AUTH", "\\u", "SYSTEM", "S_", ",_", "can", "\\u", "list", "\\u", "categories_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "heli", "os", "\\u", "auth_", "._", "models_", "import_", "Auth", "entica", "tion", "Expire", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "heli", "os_", "import_", "security_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "heli", "os", "\\u", "auth_", "import_", "views_", "as_", "auth", "\\u", "views_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "tasks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "security_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "heli", "os", "\\u", "auth_", "._", "security_", "import_", "get", "\\u", "user_", ",_", "save", "\\u", "in", "\\u", "session", "\\u", "acro", "ss", "\\u", "logo", "uts", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "uuid_", ",_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "models_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "forms_", ",_", "signals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Parameter", "s", " ", "for", " ", "every", "thing_", "\\u\\u\\uNL\\u\\u\\u_", "EL", "GAM", "AL", "\\u", "PARAMS_", "=_", "el", "gam", "al_", "._", "Crypto", "system_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "try", "ing", " ", "new", " ", "ones", " ", "from", " ", "Oli", "vie", "r", "P_", "\\u\\u\\uNL\\u\\u\\u_", "EL", "GAM", "AL", "\\u", "PARAMS_", "._", "p_", "=_", "163", "286", "320", "849", "330", "1000", "238", "405", "503", "380", "545", "732", "960", "161", "477", "118", "595", "538", "973", "916", "730", "908", "621", "4800", "406", "465", "799", "038", "583", "634", "953", "752", "941", "675", "645", "562", "182", "498", "120", "750", "264", "980", "492", "381", "375", "579", "367", "675", "648", "771", "293", "800", "310", "370", "964", "745", "767", "014", "243", "638", "518", "442", "553", "823", "973", "482", "995", "267", "304", "044", "326", "777", "047", "662", "957", "480", "269", "391", "322", "789", "378", "384", "619", "4285", "964", "464", "469", "846", "943", "061", "876", "447", "674", "624", "609", "656", "225", "800", "875", "643", "392", "126", "317", "758", "178", "959", "584", "090", "166", "763", "989", "756", "712", "661", "796", "378", "985", "576", "873", "170", "761", "772", "188", "432", "331", "506", "951", "578", "810", "612", "570", "530", "191", "330", "785", "459", "289", "835", "622", "213", "963", "131", "696", "224", "755", "098", "184", "426", "610", "470", "184", "362", "648", "069", "0102", "396", "623", "671", "836", "720", "471", "075", "593", "589", "901", "375", "030", "610", "773", "800", "236", "413", "791", "742", "659", "573", "740", "387", "111", "418", "775", "080", "434", "656", "473", "1250", "609", "196", "846", "638", "183", "903", "982", "387", "884", "578", "266", "136", "503", "697", "493", "474", "682", "071", "_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EL", "GAM", "AL", "\\u", "PARAMS_", "._", "q_", "=_", "613", "295", "662", "483", "429", "012", "925", "438", "727", "699", "789", "508", "706", "335", "596", "086", "693", "371", "311", "393", "755", "083", "704", "587", "789", "17_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EL", "GAM", "AL", "\\u", "PARAMS_", "._", "g_", "=_", "148", "874", "922", "249", "631", "876", "342", "824", "215", "371", "860", "408", "013", "0400", "801", "774", "349", "230", "448", "173", "738", "257", "193", "393", "756", "872", "447", "384", "710", "602", "991", "504", "015", "078", "403", "188", "220", "609", "028", "693", "866", "146", "445", "889", "649", "421", "527", "398", "954", "788", "920", "114", "485", "735", "261", "105", "857", "223", "657", "873", "431", "950", "512", "804", "260", "237", "286", "457", "042", "655", "085", "520", "144", "811", "174", "657", "987", "181", "124", "911", "478", "167", "430", "906", "269", "344", "244", "236", "869", "744", "997", "064", "823", "262", "188", "0001", "709", "535", "143", "047", "913", "661", "432", "883", "287", "15000", "342", "980", "239", "222", "936", "158", "360", "868", "664", "324", "334", "972", "779", "197", "624", "724", "794", "86189", "304", "238", "661", "804", "105", "584", "582", "726", "066", "271", "112", "700", "400", "912", "030", "735", "802", "389", "053", "039", "944", "722", "029", "307", "832", "074", "723", "945", "784", "985", "077", "647", "031", "912", "882", "495", "476", "598", "9999", "713", "116", "613", "025", "970", "060", "443", "389", "123", "229", "818", "234", "840", "317", "594", "745", "028", "443", "341", "126", "596", "678", "913", "1024", "573", "629", "546", "048", "637", "848", "902", "243", "503", "970", "966", "798", "589", "660", "808", "533", "_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "object", " ", "read", "y", " ", "for", " ", "serialization_", "\\u\\u\\uNL\\u\\u\\u_", "EL", "GAM", "AL", "\\u", "PARAM", "S", "\\u", "LD", "\\u", "OBJECT_", "=_", "datatypes_", "._", "LD", "Object_", "._", "instantiate", "_", "(_", "EL", "GAM", "AL", "\\u", "PARAMS_", ",_", "datatype_", "=_", "'", "lega", "cy", "/", "EG", "Param", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "single", " ", "election", " ", "server", "?", " ", "Load", " ", "the", " ", "single", " ", "election", "from", " ", "model", "s", " ", "import", " ", "Elect", "ion_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "remote", " ", "auth", " ", "utils_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " _", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "simple", " ", "admin", " ", "for", " ", "develop", "ment_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "General", " ", "election", " ", "features_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "hidden", " ", "view", " ", "beh", "ind", " ", "the", " ", "shortcut", " ", "tha", "t", " ", "perform", "s", " ", "the", " ", "actual", " ", "perm", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Trust", "ees", " ", "and", " ", "Public", " ", "Key_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "As", " ", "of", " ", "Ju", "ly", " ", "200", "9", ",", " ", "there", " ", "are", " ", "alw", "ay", "s", " ", "trust", "ees", " ", "for", " ", "a", " ", "Heli", "os", " ", "election", ":", " ", "one", " ", "trust", "ee", " ", "is", " ", "acceptabl", "e", ",", " ", "for", " ", "simple", " ", "election", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Ball", "ot", " ", "Manage", "ment_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "don", "'", "t", " ", "require", " ", "frozen", " ", "election", " ", "to", " ", "allow", " ", "for", " ", "ballot", " ", "preview_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "change", "d", " ", "from", " ", "admin", " ", "to", " ", "view", " ", "bec", "aus", "e", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "any", "one", " ", "can", " ", "see", " ", "the", " ", "question", "s", ",", " ", "the", " ", "administrati", "on", " ", "aspect", " ", "is", " ", "now_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bui", "lt", " ", "int", "o", " ", "the", " ", "page_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Individual", " ", "Vote", "rs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "cast", " ", "ballot", "s_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "election", "\\u", "url_", "(_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "settings_", "._", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "election", "\\u", "shortcut_", ",_", "args_", "=_", "[_", "election_", "._", "short", "\\u", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "election", "\\u", "badge", "\\u", "url_", "(_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "settings_", "._", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "election", "\\u", "badge", "_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "election", "\\u", "gov", "ote", "\\u", "url_", "(_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "settings_", "._", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "election", "\\u", "vote", "\\u", "shortcut_", ",_", "args_", "=_", "[_", "election_", "._", "short", "\\u", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "cast", "vote", "\\u", "url_", "(_", "cast", "\\u", "vote_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "settings_", "._", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "cast", "vote", "\\u", "shortcut_", ",_", "args_", "=_", "[_", "cast", "\\u", "vote_", "._", "vote", "\\u", "tiny", "hash_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "user", "\\u", "rea", "uth_", "(_", "request_", ",_", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "shou", "ld", " ", "we", " ", "be", " ", "war", "y", " ", "of", " ", "infini", "te", " ", "redirec", "ts", " ", "here", ",", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "a", " ", "parameter", " ", "to", " ", "prevent", " ", "it", "?", " ", "Ma", "yb", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "login", "\\u", "url_", "=_", "\"%", "s", "%", "s", "?", "%", "s", "\"_", "%_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "auth", "\\u", "views_", "._", "start_", ",_", "args_", "=_", "[_", "user_", "._", "user", "\\u", "type_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "urllib_", "._", "urlencode_", "(_", "{_", "'", "return", "\\u", "url", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "get", "\\u", "full", "\\u", "path_", "(_", ")_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "login", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "admin", "\\u", "auto", "login_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"", "local", "host", "\"_", "not_", "in_", "settings_", "._", "URL", "\\u", "HOST_", "and_", "\"", "127", ".0", ".0", ".1", "\"_", "not_", "in_", "settings_", "._", "URL", "\\u", "HOST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "users_", "=_", "User_", "._", "objects_", "._", "filter_", "(_", "admin", "\\u", "p_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "users_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Response_", "(_", "\"", "no", " ", "admin", " ", "users", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "users_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Response_", "(_", "\"", "no", " ", "users", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "user_", "=_", "users_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "session_", "[_", "'", "user", "'_", "]_", "=_", "{_", "'", "type", "'_", ":_", "user_", "._", "user", "\\u", "type_", ",_", "'", "user", "\\u", "id", "'_", ":_", "user_", "._", "user", "\\u", "id_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "return", "\\u", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "election", "\\u", "params_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "EL", "GAM", "AL", "\\u", "PARAM", "S", "\\u", "LD", "\\u", "OBJECT_", "._", "to", "JSO", "ND", "ict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "election", "\\u", "verifier_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "\"", "tally", "\\u", "verifier", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "election", "\\u", "single", "\\u", "ballot", "\\u", "verifier_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "\"", "ballot", "\\u", "verifier", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "election", "\\u", "shortcut_", "(_", "request_", ",_", "election", "\\u", "short", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "election_", "=_", "Elect", "ion_", "._", "get", "\\u", "by", "\\u", "short", "\\u", "name_", "(_", "election", "\\u", "short", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "election_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "one", "\\u", "election", "\\u", "view_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "election", "\\u", "vote", "\\u", "shortcut_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vote", "\\u", "url_", "=_", "\"%", "s", "/", "boot", "h", "/", "vote", ".", "html", "?", "%", "s", "\"_", "%_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", ",_", "urllib_", "._", "urlencode_", "(_", "{_", "'", "election", "\\u", "url", "'_", ":_", "reverse_", "(_", "one", "\\u", "election_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "cookie", "\\u", "url_", "=_", "\"%", "s", "?", "%", "s", "\"_", "%_", "(_", "reverse_", "(_", "test\\u", "cookie_", ")_", ",_", "urllib_", "._", "urlencode_", "(_", "{_", "'", "continue", "\\u", "url", "'_", ":_", "vote", "\\u", "url_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "test\\u", "cookie", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "election", "\\u", "vote", "\\u", "shortcut_", "(_", "request_", ",_", "election", "\\u", "short", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "election_", "=_", "Elect", "ion_", "._", "get", "\\u", "by", "\\u", "short", "\\u", "name_", "(_", "election", "\\u", "short", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "election_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "election", "\\u", "vote", "\\u", "shortcut_", "(_", "request_", ",_", "election", "\\u", "uuid_", "=_", "election_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "cast", "vote", "\\u", "shortcut", "\\u", "by", "\\u", "election_", "(_", "request_", ",_", "election_", ",_", "cast", "\\u", "vote_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "'", "cast", "vote", "'_", ",_", "{_", "'", "cast", "\\u", "vote", "'_", ":_", "cast", "\\u", "vote_", ",_", "'", "vote", "\\u", "content", "'_", ":_", "cast", "\\u", "vote_", "._", "vote_", "._", "to", "JSON_", "(_", ")_", ",_", "'", "the", "\\u", "voter", "'_", ":_", "cast", "\\u", "vote_", "._", "voter", "_", ",_", "'", "election", "'_", ":_", "election_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cast", "vote", "\\u", "shortcut_", "(_", "request_", ",_", "vote", "\\u", "tiny", "hash_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cast", "\\u", "vote_", "=_", "Cast", "Vote", "_", "._", "objects_", "._", "get_", "(_", "vote", "\\u", "tiny", "hash_", "=_", "vote", "\\u", "tiny", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Cast", "Vote", "_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "cast", "vote", "\\u", "shortcut", "\\u", "by", "\\u", "election_", "(_", "request_", ",_", "election", "\\u", "uuid_", "=_", "cast", "\\u", "vote_", "._", "voter", "_", "._", "election_", "._", "uuid_", ",_", "cast", "\\u", "vote_", "=_", "cast", "\\u", "vote_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "trust", "ee", "\\u", "check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "trust", "ee", "\\u", "key", "generator_", "(_", "request_", ",_", "election_", ",_", "trust", "ee_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "A", " ", "key", " ", "generat", "or", " ", "with", " ", "the", " ", "current", " ", "params", ",", " ", "like", " ", "the", " ", "trust", "ee", " ", "home", " ", "but", " ", "with", "out", " ", "a", " ", "specific", " ", "election", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eg", "\\u", "params", "\\u", "json_", "=_", "utils_", "._", "to", "\\u", "json_", "(_", "EL", "GAM", "AL", "\\u", "PARAM", "S", "\\u", "LD", "\\u", "OBJECT_", "._", "to", "JSO", "ND", "ict_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "\"", "election", "\\u", "key", "generat", "or", "\"_", ",_", "{_", "'", "eg", "\\u", "params", "\\u", "json", "'_", ":_", "eg", "\\u", "params", "\\u", "json_", ",_", "'", "election", "'_", ":_", "election_", ",_", "'", "trust", "ee", "'_", ":_", "trust", "ee_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "election", "s", "\\u", "admin", "iste", "red_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "can", "\\u", "create", "\\u", "election_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Forbidden_", "(_", "'", "only", " ", "an", " ", "administrat", "or", " ", "has", " ", "election", "s", " ", "to", " ", "admin", "iste", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "user_", "=_", "get", "\\u", "user_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "election", "s_", "=_", "Elect", "ion_", "._", "get", "\\u", "by", "\\u", "user", "\\u", "as", "\\u", "admin_", "(_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "\"", "election", "s", "\\u", "admin", "iste", "red", "\"_", ",_", "{_", "'", "election", "s", "'_", ":_", "election", "s_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "election", "s", "\\u", "vote", "d_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "get", "\\u", "user_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "election", "s_", "=_", "Elect", "ion_", "._", "get", "\\u", "by", "\\u", "user", "\\u", "as", "\\u", "voter", "_", "(_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "\"", "election", "s", "\\u", "vote", "d", "\"_", ",_", "{_", "'", "election", "s", "'_", ":_", "election", "s_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "election", "\\u", "new_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "can", "\\u", "create", "\\u", "election_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Forbidden_", "(_", "'", "only", " ", "an", " ", "administrat", "or", " ", "can", " ", "create", " ", "an", " ", "election", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "error_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "get", "\\u", "user_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "\"", "GET", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "election", "\\u", "form_", "=_", "forms_", "._", "Elect", "ion", "Form_", "(_", "initial_", "=_", "{_", "'", "private", "\\u", "p", "'_", ":_", "settings_", "._", "HE", "LI", "OS", "\\u", "PRIVATE", "\\u", "DEFAULT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "help", "\\u", "email", "'_", ":_", "user_", "._", "info_", "._", "get_", "(_", "\"", "email", "\"_", ",_", "''_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "csrf_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "election", "\\u", "form_", "=_", "forms_", "._", "Elect", "ion", "Form_", "(_", "request_", "._", "POST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "election", "\\u", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "the", " ", "election", " ", "obj_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "election", "\\u", "params_", "=_", "dict_", "(_", "election", "\\u", "form_", "._", "clean", "ed", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "the", " ", "short", " ", "name", " ", "valid_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "heli", "os", "\\u", "utils_", "._", "urlencode_", "(_", "election", "\\u", "params_", "[_", "'", "short", "\\u", "name", "'_", "]_", ")_", "==_", "election", "\\u", "params_", "[_", "'", "short", "\\u", "name", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "election", "\\u", "params_", "[_", "'", "uuid", "'_", "]_", "=_", "str_", "(_", "uuid_", "._", "uuid1_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "election", "\\u", "params_", "[_", "'", "cast", "\\u", "url", "'_", "]_", "=_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "one", "\\u", "election", "\\u", "cast_", ",_", "args_", "=_", "[_", "election", "\\u", "params_", "[_", "'", "uuid", "'_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "registration", " ", "starts", " ", "closed_", "\\u\\u\\uNL\\u\\u\\u_", "election", "\\u", "params_", "[_", "'", "open", "reg", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "get", "\\u", "user_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "election", "\\u", "params_", "[_", "'", "admin", "'_", "]_", "=_", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "election_", ",_", "created", "\\u", "p_", "=_", "Elect", "ion_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "**_", "election", "\\u", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "created", "\\u", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "Heli", "os", " ", "as", " ", "a", " ", "trust", "ee", " ", "by", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "election_", "._", "generat", "e\\u", "trust", "ee_", "(_", "EL", "GAM", "AL", "\\u", "PARAMS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "one", "\\u", "election", "\\u", "view_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "\"", "An", " ", "election", " ", "with", " ", "short", " ", "name", " ", "%", "s", " ", "alr", "ead", "y", " ", "exist", "s", "\"_", "%_", "election", "\\u", "params_", "[_", "'", "short", "\\u", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "\"", "No", " ", "special", " ", "character", "s", " ", "allow", "ed", " ", "in", " ", "the", " ", "short", " ", "name", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "\"", "election", "\\u", "new", "\"_", ",_", "{_", "'", "election", "\\u", "form", "'_", ":_", "election", "\\u", "form_", ",_", "'", "error", "'_", ":_", "error_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "admin_", "(_", "frozen_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "one", "\\u", "election", "\\u", "edit_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "REL", "EV", "ANT", "\\u", "FIELDS_", "=_", "[_", "'", "short", "\\u", "name", "'_", ",_", "'", "name", "'_", ",_", "'", "description", "'_", ",_", "'", "use", "\\u", "voter", "\\u", "alias", "es", "'_", ",_", "'", "election", "\\u", "type", "'_", ",_", "'", "private", "\\u", "p", "'_", ",_", "'", "help", "\\u", "email", "'_", ",_", "'", "randomize", "\\u", "answer", "\\u", "order", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "REL", "EV", "ANT", "\\u", "FIELDS", " ", "+=", " ", "['", "use", "\\u", "advanced", "\\u", "audit", "\\u", "features", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "settings_", "._", "ALLOW", "\\u", "ELECT", "ION", "\\u", "INFO", "\\u", "URL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "REL", "EV", "ANT", "\\u", "FIELDS_", "+=_", "[_", "'", "election", "\\u", "info", "\\u", "url", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "\"", "GET", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "attr", "\\u", "name_", "in_", "REL", "EV", "ANT", "\\u", "FIELDS_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "[_", "attr", "\\u", "name_", "]_", "=_", "getattr_", "(_", "election_", ",_", "attr", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "election", "\\u", "form_", "=_", "forms_", "._", "Elect", "ion", "Form_", "(_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "csrf_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "election", "\\u", "form_", "=_", "forms_", "._", "Elect", "ion", "Form_", "(_", "request_", "._", "POST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "election", "\\u", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clean", "\\u", "data_", "=_", "election", "\\u", "form_", "._", "clean", "ed", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "attr", "\\u", "name_", "in_", "REL", "EV", "ANT", "\\u", "FIELDS_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "election_", ",_", "attr", "\\u", "name_", ",_", "clean", "\\u", "data_", "[_", "attr", "\\u", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "election_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "one", "\\u", "election", "\\u", "view_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "\"", "election", "\\u", "edit", "\"_", ",_", "{_", "'", "election", "\\u", "form", "'_", ":_", "election", "\\u", "form_", ",_", "'", "election", "'_", ":_", "election_", ",_", "'", "error", "'_", ":_", "error_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "admin_", "(_", "frozen_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "one", "\\u", "election", "\\u", "schedule_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Response_", "(_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "return", "\\u", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "one", "\\u", "election_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "election_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "election_", "._", "to", "JSO", "ND", "ict_", "(_", "complete_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "return", "\\u", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "one", "\\u", "election", "\\u", "meta_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "election_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "election_", "._", "metadata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "election", "\\u", "badge", "_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "election", "\\u", "url_", "=_", "get", "\\u", "election", "\\u", "url_", "(_", "election_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "{_", "'", "election", "'_", ":_", "election_", ",_", "'", "election", "\\u", "url", "'_", ":_", "election", "\\u", "url_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "option", "\\u", "name_", "in_", "[_", "'", "show", "\\u", "title", "'_", ",_", "'", "show", "\\u", "vote", "\\u", "link", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "[_", "option", "\\u", "name_", "]_", "=_", "(_", "request_", "._", "GET_", "._", "get_", "(_", "option", "\\u", "name_", ",_", "'", "1", "'_", ")_", "==_", "'", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "\"", "election", "\\u", "badge", "\"_", ",_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "one", "\\u", "election", "\\u", "view_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "get", "\\u", "user_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin", "\\u", "p_", "=_", "security_", "._", "user", "\\u", "can", "\\u", "admin", "\\u", "election_", "(_", "user_", ",_", "election_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "can", "\\u", "feature", "\\u", "p_", "=_", "security_", "._", "user", "\\u", "can", "\\u", "feature", "\\u", "election_", "(_", "user_", ",_", "election_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "not", "registered_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eligible", "\\u", "p_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "election", "\\u", "url_", "=_", "get", "\\u", "election", "\\u", "url_", "(_", "election_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "election", "\\u", "badge", "\\u", "url_", "=_", "get", "\\u", "election", "\\u", "badge", "\\u", "url_", "(_", "election_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status", "\\u", "update", "\\u", "message_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vote", "\\u", "url_", "=_", "\"%", "s", "/", "boot", "h", "/", "vote", ".", "html", "?", "%", "s", "\"_", "%_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", ",_", "urllib_", "._", "urlencode_", "(_", "{_", "'", "election", "\\u", "url", "'_", ":_", "reverse_", "(_", "one", "\\u", "election_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "cookie", "\\u", "url_", "=_", "\"%", "s", "?", "%", "s", "\"_", "%_", "(_", "reverse_", "(_", "test\\u", "cookie_", ")_", ",_", "urllib_", "._", "urlencode_", "(_", "{_", "'", "continue", "\\u", "url", "'_", ":_", "vote", "\\u", "url_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "voter", "_", "=_", "Vote", "r_", "._", "get", "\\u", "by", "\\u", "election", "\\u", "and", "\\u", "user_", "(_", "election_", ",_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "voter", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eligible", "\\u", "p_", "=_", "\\u", "check", "\\u", "eli", "gib", "ility_", "(_", "election_", ",_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Auth", "entica", "tion", "Expire", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "user", "\\u", "rea", "uth_", "(_", "request_", ",_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "not", "registered_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "voter", "_", "=_", "get", "\\u", "voter", "_", "(_", "request_", ",_", "user_", ",_", "election_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "voter", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "cast", " ", "any", " ", "vote", "s", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "votes_", "=_", "Cast", "Vote", "_", "._", "get", "\\u", "by", "\\u", "voter", "_", "(_", "voter", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "votes_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "status", " ", "update", " ", "message", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "election_", "._", "open", "reg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "election_", "._", "voting", "\\u", "has", "\\u", "started_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status", "\\u", "update", "\\u", "message_", "=_", "u", "\"", "Vote", " ", "in", " ", "%", "s", "\"_", "%_", "election_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status", "\\u", "update", "\\u", "message_", "=_", "u", "\"", "Register", " ", "to", " ", "vote", " ", "in", " ", "%", "s", "\"_", "%_", "election_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "result", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "election_", "._", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status", "\\u", "update", "\\u", "message_", "=_", "u", "\"", "Result", "s", " ", "are", " ", "in", " ", "for", " ", "%", "s", "\"_", "%_", "election_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "trust", "ees", "_", "=_", "Trust", "ee_", "._", "get", "\\u", "by", "\\u", "election_", "(_", "election_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shou", "ld", " ", "we", " ", "show", " ", "the", " ", "result", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "show", "\\u", "result_", "=_", "election_", "._", "result", "\\u", "released", "\\u", "at_", "or_", "(_", "election_", "._", "result_", "and_", "admin", "\\u", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "'", "election", "\\u", "view", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "election", "'_", ":_", "election_", ",_", "'", "trust", "ees", "'_", ":_", "trust", "ees", "_", ",_", "'", "admin", "\\u", "p", "'_", ":_", "admin", "\\u", "p_", ",_", "'", "user", "'_", ":_", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "voter", "'_", ":_", "voter", "_", ",_", "'", "vote", "s", "'_", ":_", "votes_", ",_", "'", "not", "register", "ed", "'_", ":_", "not", "registered_", ",_", "'", "eligible", "\\u", "p", "'_", ":_", "eligible", "\\u", "p_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "can", "\\u", "feature", "\\u", "p", "'_", ":_", "can", "\\u", "feature", "\\u", "p_", ",_", "'", "election", "\\u", "url", "'_", ":_", "election", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "vote", "\\u", "url", "'_", ":_", "vote", "\\u", "url_", ",_", "'", "election", "\\u", "badge", "\\u", "url", "'_", ":_", "election", "\\u", "badge", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "show", "\\u", "result", "'_", ":_", "show", "\\u", "result_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test\\u", "cookie", "\\u", "url", "'_", ":_", "test\\u", "cookie", "\\u", "url_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "cookie_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue", "\\u", "url_", "=_", "request_", "._", "GET_", "[_", "'", "continue", "\\u", "url", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "session_", "._", "set\\u", "test\\u", "cookie_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "\\u", "url_", "=_", "\"%", "s", "?", "%", "s", "\"_", "%_", "(_", "reverse_", "(_", "test\\u", "cookie", "\\u", "2_", ")_", ",_", "urllib_", "._", "urlencode_", "(_", "{_", "'", "continue", "\\u", "url", "'_", ":_", "continue", "\\u", "url_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "next", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "cookie", "\\u", "2_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue", "\\u", "url_", "=_", "request_", "._", "GET_", "[_", "'", "continue", "\\u", "url", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "request_", "._", "session_", "._", "test\\u", "cookie", "\\u", "worked", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "(_", "\"%", "s", "?", "%", "s", "\"_", "%_", "(_", "reverse_", "(_", "noco", "oki", "es_", ")_", ",_", "urllib_", "._", "urlencode_", "(_", "{_", "'", "continue", "\\u", "url", "'_", ":_", "continue", "\\u", "url_", "}_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request_", "._", "session_", "._", "delete", "\\u", "test\\u", "cookie_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "continue", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "noco", "oki", "es_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret", "est", "\\u", "url_", "=_", "\"%", "s", "?", "%", "s", "\"_", "%_", "(_", "reverse_", "(_", "test\\u", "cookie_", ")_", ",_", "urllib_", "._", "urlencode_", "(_", "{_", "'", "continue", "\\u", "url", "'_", ":_", "request_", "._", "GET_", "[_", "'", "continue", "\\u", "url", "'_", "]_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "'", "noco", "oki", "es", "'_", ",_", "{_", "'", "ret", "est", "\\u", "url", "'_", ":_", "ret", "est", "\\u", "url_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "return", "\\u", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "list", "\\u", "trust", "ees", "_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trust", "ees", "_", "=_", "Trust", "ee_", "._", "get", "\\u", "by", "\\u", "election_", "(_", "election_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "t_", "._", "to", "JSO", "ND", "ict_", "(_", "complete_", "=_", "True_", ")_", "for_", "t_", "in_", "trust", "ees", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "list", "\\u", "trust", "ees", "\\u", "view_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trust", "ees", "_", "=_", "Trust", "ee_", "._", "get", "\\u", "by", "\\u", "election_", "(_", "election_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "get", "\\u", "user_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin", "\\u", "p_", "=_", "security_", "._", "user", "\\u", "can", "\\u", "admin", "\\u", "election_", "(_", "user_", ",_", "election_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "'", "list", "\\u", "trust", "ees", "'_", ",_", "{_", "'", "election", "'_", ":_", "election_", ",_", "'", "trust", "ees", "'_", ":_", "trust", "ees", "_", ",_", "'", "admin", "\\u", "p", "'_", ":_", "admin", "\\u", "p_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "admin_", "(_", "frozen_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "new", "\\u", "trust", "ee_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "method_", "==_", "\"", "GET", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "'", "new", "\\u", "trust", "ee", "'_", ",_", "{_", "'", "election", "'_", ":_", "election_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "csrf_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "public", " ", "key", " ", "and", " ", "the", " ", "hash", ",", " ", "and", " ", "add", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "request_", "._", "POST_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email_", "=_", "request_", "._", "POST_", "[_", "'", "email", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "trust", "ee_", "=_", "Trust", "ee_", "(_", "uuid_", "=_", "str_", "(_", "uuid_", "._", "uuid1_", "(_", ")_", ")_", ",_", "election_", "=_", "election_", ",_", "name_", "=_", "name_", ",_", "email_", "=_", "email_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trust", "ee_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "list", "\\u", "trust", "ees", "\\u", "view_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "admin_", "(_", "frozen_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "new", "\\u", "trust", "ee", "\\u", "heli", "os_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Make", " ", "Heli", "os", " ", "a", " ", "trust", "ee", " ", "of", " ", "the", " ", "election", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "election_", "._", "generat", "e\\u", "trust", "ee_", "(_", "EL", "GAM", "AL", "\\u", "PARAMS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "list", "\\u", "trust", "ees", "\\u", "view_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "admin_", "(_", "frozen_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "delete", "\\u", "trust", "ee_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trust", "ee_", "=_", "Trust", "ee_", "._", "get", "\\u", "by", "\\u", "election", "\\u", "and", "\\u", "uuid_", "(_", "election_", ",_", "request_", "._", "GET_", "[_", "'", "uuid", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trust", "ee_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "list", "\\u", "trust", "ees", "\\u", "view_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "trust", "ee", "\\u", "login_", "(_", "request_", ",_", "election", "\\u", "short", "\\u", "name_", ",_", "trust", "ee", "\\u", "email_", ",_", "trust", "ee", "\\u", "secret_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "election_", "=_", "Elect", "ion_", "._", "get", "\\u", "by", "\\u", "short", "\\u", "name_", "(_", "election", "\\u", "short", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "election_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trust", "ee_", "=_", "Trust", "ee_", "._", "get", "\\u", "by", "\\u", "election", "\\u", "and", "\\u", "email_", "(_", "election_", ",_", "trust", "ee", "\\u", "email_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "trust", "ee_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "trust", "ee_", "._", "secret_", "==_", "trust", "ee", "\\u", "secret_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set\\u", "logged", "\\u", "in", "\\u", "trust", "ee_", "(_", "request_", ",_", "trust", "ee_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "trust", "ee", "\\u", "home_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", ",_", "trust", "ee_", "._", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "bad", " ", "secret", ",", " ", "we", "'", "ll", " ", "let", " ", "tha", "t", " ", "redirec", "t", " ", "to", " ", "the", " ", "front", " ", "page_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "no", " ", "suc", "h", " ", "trust", "ee_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "admin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "trust", "ee", "\\u", "send", "\\u", "url_", "(_", "request_", ",_", "election_", ",_", "trust", "ee", "\\u", "uuid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trust", "ee_", "=_", "Trust", "ee_", "._", "get", "\\u", "by", "\\u", "election", "\\u", "and", "\\u", "uuid_", "(_", "election_", ",_", "trust", "ee", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "trust", "ee", "\\u", "login_", ",_", "args_", "=_", "[_", "election_", "._", "short", "\\u", "name_", ",_", "trust", "ee_", "._", "email_", ",_", "trust", "ee_", "._", "secret_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "\"\"\"", "\\", "10", ";", "\\", "10", ";", "You", " ", "are", " ", "a", " ", "trust", "ee", " ", "for", " ", "%", "s", ".", "\\", "10", ";", "\\", "10", ";", "You", "r", " ", "trust", "ee", " ", "dash", "board", " ", "is", " ", "at", "\\", "10", ";", "\\", "10", ";", " ", " ", "%", "s", "\\", "10", ";", " ", " ", "\\", "10", ";", "--", "\\", "10", ";", "Heli", "os", " ", " ", "\\", "10", ";\"\"\"_", "%_", "(_", "election_", "._", "name_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "heli", "os", "\\u", "utils_", "._", "send", "\\u", "email_", "(_", "settings_", "._", "SERVER", "\\u", "EMAIL_", ",_", "[_", "\"%", "s", " ", "<", "%", "s", ">\"_", "%_", "(_", "trust", "ee_", "._", "name_", ",_", "trust", "ee_", "._", "email_", ")_", "]_", ",_", "'", "your", " ", "trust", "ee", " ", "home", "page", " ", "for", " ", "%", "s", "'_", "%_", "election_", "._", "name_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "\"", "URL", " ", "%", "s", " ", "\"_", "%_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "list", "\\u", "trust", "ees", "\\u", "view_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "trust", "ee", "\\u", "check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "trust", "ee", "\\u", "home_", "(_", "request_", ",_", "election_", ",_", "trust", "ee_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "'", "trust", "ee", "\\u", "home", "'_", ",_", "{_", "'", "election", "'_", ":_", "election_", ",_", "'", "trust", "ee", "'_", ":_", "trust", "ee_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "trust", "ee", "\\u", "check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "trust", "ee", "\\u", "check", "\\u", "sk_", "(_", "request_", ",_", "election_", ",_", "trust", "ee_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "'", "trust", "ee", "\\u", "check", "\\u", "sk", "'_", ",_", "{_", "'", "election", "'_", ":_", "election_", ",_", "'", "trust", "ee", "'_", ":_", "trust", "ee_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "trust", "ee", "\\u", "check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "trust", "ee", "\\u", "upload", "\\u", "pk_", "(_", "request_", ",_", "election_", ",_", "trust", "ee_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "method_", "==_", "\"", "POST", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "public", " ", "key", " ", "and", " ", "the", " ", "hash", ",", " ", "and", " ", "add", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "public", "\\u", "key", "\\u", "and", "\\u", "proof", "_", "=_", "utils_", "._", "from", "\\u", "json_", "(_", "request_", "._", "POST_", "[_", "'", "public", "\\u", "key", "\\u", "json", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trust", "ee_", "._", "public", "\\u", "key_", "=_", "alg", "s_", "._", "EG", "Public", "Key_", "._", "from", "JSO", "ND", "ict_", "(_", "public", "\\u", "key", "\\u", "and", "\\u", "proof", "_", "[_", "'", "public", "\\u", "key", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trust", "ee_", "._", "po", "k_", "=_", "alg", "s_", "._", "DL", "og", "Pro", "of_", "._", "from", "JSO", "ND", "ict_", "(_", "public", "\\u", "key", "\\u", "and", "\\u", "proof", "_", "[_", "'", "po", "k", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "verify", " ", "the", " ", "po", "k_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "trust", "ee_", "._", "public", "\\u", "key_", "._", "verify", "\\u", "sk", "\\u", "proof", "_", "(_", "trust", "ee_", "._", "po", "k_", ",_", "alg", "s_", "._", "DL", "og", "\\u", "chall", "enge", "\\u", "generator_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "bad", " ", "po", "k", " ", "for", " ", "this", " ", "public", " ", "key", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "trust", "ee_", "._", "public", "\\u", "key", "\\u", "hash_", "=_", "utils_", "._", "hash", "\\u", "b64", "_", "(_", "utils_", "._", "to", "\\u", "json_", "(_", "trust", "ee_", "._", "public", "\\u", "key_", "._", "to", "JSO", "ND", "ict_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "trust", "ee_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "send", " ", "a", " ", "note", " ", "to", " ", "admin_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "election_", "._", "admin_", "._", "send", "\\u", "message_", "(_", "\"%", "s", " ", "-", " ", "trust", "ee", " ", "pk", " ", "upload", "\"_", "%_", "election_", "._", "name_", ",_", "\"", "trust", "ee", " ", "%", "s", " ", "(%", "s", ")", " ", "uploade", "d", " ", "a", " ", "pk", ".\"_", "%_", "(_", "trust", "ee_", "._", "name_", ",_", "trust", "ee_", "._", "email_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "oh", " ", "well", ",", " ", "no", " ", "message", " ", "sent_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "trust", "ee", "\\u", "home_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", ",_", "trust", "ee_", "._", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "return", "\\u", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "random", "ness_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "get", " ", "some", " ", "random", "ness", " ", "to", " ", "spri", "nk", "le", " ", "int", "o", " ", "the", " ", "sj", "cl", " ", "entr", "opy", " ", "pool", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "back", " ", "to", " ", "uran", "dom", ",", " ", "it", "'", "s", " ", "fine", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "random", "ness", "\"_", ":_", "base64_", "._", "b64encode_", "(_", "os_", "._", "urandom_", "(_", "32_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "random", "ness", "\"", " ", ":", " ", "base64", ".", "b64", "encode", "(", "uuid", ".", "uuid", "4", "()", ".", "bytes", " ", "+", " ", "uuid", ".", "uuid", "4", "()", ".", "bytes", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", "frozen_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "return", "\\u", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "encrypt", "\\u", "ballot", "_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "perform", " ", "the", " ", "ballot", " ", "encrypt", "ion", " ", "give", "n", " ", "answer", "s", "\\u", "json", ",", " ", "a", " ", "JSO", "N", "'", "ified", " ", "list", " ", "of", " ", "list", " ", "of", " ", "answer", "s", "\\", "10", ";", " ", " ", "(", "list", " ", "of", " ", "list", " ", "bec", "aus", "e", " ", "each", " ", "question", " ", "coul", "d", " ", "have", " ", "a", " ", "list", " ", "of", " ", "answer", "s", " ", "if", " ", "more", " ", "than", " ", "one", ".)", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "may", "be", " ", "make", " ", "this", " ", "just", " ", "request", ".", "POST", " ", "at", " ", "some", " ", "point", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "answers_", "=_", "utils_", "._", "from", "\\u", "json_", "(_", "request_", "._", "REQUEST_", "[_", "'", "answer", "s", "\\u", "json", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ev_", "=_", "homo", "morphi", "c_", "._", "Encrypt", "ed", "Vote", "_", "._", "from", "Elect", "ion", "And", "Answer", "s_", "(_", "election_", ",_", "answers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ev_", "._", "ld", "\\u", "object_", "._", "include", "Random", "ness_", "(_", ")_", "._", "to", "JSO", "ND", "ict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", "frozen_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "post", "\\u", "audit", "ed", "\\u", "ballot", "_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "method_", "==_", "\"", "POST", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raw", "\\u", "vote_", "=_", "request_", "._", "POST_", "[_", "'", "audit", "ed", "\\u", "ballot", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "encrypt", "ed", "\\u", "vote_", "=_", "election", "alg", "s_", "._", "Encrypt", "ed", "Vote", "_", "._", "from", "JSO", "ND", "ict_", "(_", "utils_", "._", "from", "\\u", "json_", "(_", "raw", "\\u", "vote_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vote", "\\u", "hash_", "=_", "encrypt", "ed", "\\u", "vote_", "._", "get", "\\u", "hash_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "audit", "ed", "\\u", "ballot", "_", "=_", "Audi", "ted", "Ball", "ot_", "(_", "raw", "\\u", "vote_", "=_", "raw", "\\u", "vote_", ",_", "vote", "\\u", "hash_", "=_", "vote", "\\u", "hash_", ",_", "election_", "=_", "election_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "audit", "ed", "\\u", "ballot", "_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "SUCCESS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "one", "\\u", "election", "\\u", "cast_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "on", " ", "a", " ", "GET", ",", " ", "this", " ", "is", " ", "a", " ", "cancellat", "ion", ",", " ", "on", " ", "a", " ", "POST", " ", "it", "'", "s", " ", "a", " ", "cast", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "\"", "GET", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "\"%", "s", "%", "s", "\"_", "%_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", ",_", "reverse_", "(_", "one", "\\u", "election", "\\u", "view_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "user_", "=_", "get", "\\u", "user_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "encrypt", "ed", "\\u", "vote_", "=_", "request_", "._", "POST_", "[_", "'", "encrypt", "ed", "\\u", "vote", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "save", "\\u", "in", "\\u", "session", "\\u", "acro", "ss", "\\u", "logo", "uts", "_", "(_", "request_", ",_", "'", "encrypt", "ed", "\\u", "vote", "'_", ",_", "encrypt", "ed", "\\u", "vote_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "\"%", "s", "%", "s", "\"_", "%_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", ",_", "reverse_", "(_", "one", "\\u", "election", "\\u", "cast", "\\u", "confirm_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", "allow", "\\u", "login", "s_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "password", "\\u", "voter", "\\u", "login_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Thi", "s", " ", "is", " ", "used", " ", "to", " ", "log", " ", "in", " ", "as", " ", "a", " ", "voter", " ", "for", " ", "a", " ", "partic", "ular", " ", "election", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "URL", " ", "to", " ", "send", " ", "the", " ", "user", " ", "to", " ", "after", " ", "the", "y", "'", "ve", " ", "logged", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "url_", "=_", "request_", "._", "REQUEST_", "._", "get_", "(_", "'", "return", "\\u", "url", "'_", ",_", "reverse_", "(_", "one", "\\u", "election", "\\u", "cast", "\\u", "confirm_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bad", "\\u", "voter", "\\u", "login_", "=_", "(_", "request_", "._", "GET_", "._", "get_", "(_", "'", "bad", "\\u", "voter", "\\u", "login", "'_", ",_", "\"", "0", "\"_", ")_", "==_", "\"", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "\"", "GET", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "user", " ", "logged", " ", "in", " ", "some", "how", " ", "in", " ", "the", " ", "inter", "im", ",", " ", "e", ".", "g", ".", " ", "usi", "ng", " ", "the", " ", "login", " ", "link", " ", "for", " ", "administrati", "on", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "then", " ", "go", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "user", "\\u", "can", "\\u", "see", "\\u", "election_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "one", "\\u", "election", "\\u", "view_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "password", "\\u", "login", "\\u", "form_", "=_", "forms_", "._", "Vote", "r", "Passw", "ord", "Form_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "'", "password", "\\u", "voter", "\\u", "login", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "election", "'_", ":_", "election_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "return", "\\u", "url", "'_", ":_", "return", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "\\u", "login", "\\u", "form", "'_", ":_", "password", "\\u", "login", "\\u", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bad", "\\u", "voter", "\\u", "login", "'_", ":_", "bad", "\\u", "voter", "\\u", "login_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "login", "\\u", "url_", "=_", "request_", "._", "REQUEST_", "._", "get_", "(_", "'", "login", "\\u", "url", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "login", "\\u", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "login", " ", "depend", "ing", " ", "on", " ", "whe", "ther", " ", "this", " ", "is", " ", "a", " ", "private", " ", "election_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "caus", "e", " ", "if", " ", "it", "'", "s", " ", "private", " ", "the", " ", "login", " ", "is", " ", "happ", "eni", "ng", " ", "on", " ", "the", " ", "front", " ", "page_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "election_", "._", "private", "\\u", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "login", "\\u", "url_", "=_", "reverse_", "(_", "password", "\\u", "voter", "\\u", "login_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "login", "\\u", "url_", "=_", "reverse_", "(_", "one", "\\u", "election", "\\u", "cast", "\\u", "confirm_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "password", "\\u", "login", "\\u", "form_", "=_", "forms_", "._", "Vote", "r", "Passw", "ord", "Form_", "(_", "request_", "._", "POST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "password", "\\u", "login", "\\u", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "voter", "_", "=_", "election_", "._", "voter", "\\u", "set_", "._", "get_", "(_", "voter", "\\u", "login", "\\u", "id_", "=_", "password", "\\u", "login", "\\u", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "voter", "\\u", "id", "'_", "]_", "._", "strip_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "voter", "\\u", "password_", "=_", "password", "\\u", "login", "\\u", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "password", "'_", "]_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "session_", "[_", "'", "CURREN", "T", "\\u", "VO", "TER", "\\u", "ID", "'_", "]_", "=_", "voter", "_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "we", "'", "re", " ", "ask", "ed", " ", "to", " ", "cast", ",", " ", "let", "'", "s", " ", "do", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "POST_", "._", "get_", "(_", "'", "cast", "\\u", "ballot", "'_", ")_", "==_", "\"", "1", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "one", "\\u", "election", "\\u", "cast", "\\u", "confirm_", "(_", "request_", ",_", "election_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Vote", "r_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "redirec", "t", "\\u", "url_", "=_", "login", "\\u", "url_", "+_", "\"?\"_", "+_", "urllib_", "._", "urlencode_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bad", "\\u", "voter", "\\u", "login", "'_", ":_", "'", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "return", "\\u", "url", "'_", ":_", "return", "\\u", "url_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "redirec", "t", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "return", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "one", "\\u", "election", "\\u", "cast", "\\u", "confirm_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "get", "\\u", "user_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "no", " ", "encrypt", "ed", " ", "vote", ",", " ", "the", " ", "user", " ", "is", " ", "relo", "ading", " ", "this", " ", "page", " ", "or", " ", "other", "wis", "e", " ", "getti", "ng", " ", "here", " ", "in", " ", "a", " ", "bad", " ", "way_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "request_", "._", "session_", "._", "has", "\\u", "key_", "(_", "'", "encrypt", "ed", "\\u", "vote", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "URL", "\\u", "HOST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "election", " ", "not", " ", "frozen", " ", "or", " ", "started_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "election_", "._", "voting", "\\u", "has", "\\u", "started_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "'", "election", "\\u", "not", "\\u", "start", "ed", "'_", ",_", "{_", "'", "election", "'_", ":_", "election_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "voter", "_", "=_", "get", "\\u", "voter", "_", "(_", "request_", ",_", "user_", ",_", "election_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "auto", "-", "register", " ", "this", " ", "person", " ", "if", " ", "the", " ", "election", " ", "is", " ", "open", "reg_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "user_", "and_", "not_", "voter", "_", "and_", "election_", "._", "open", "reg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "voter", "_", "=_", "\\u", "register", "\\u", "voter", "_", "(_", "election_", ",_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tall", "ied", " ", "election", ",", " ", "no", " ", "vote", " ", "casting", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "election_", "._", "encrypt", "ed", "\\u", "tally", "_", "or_", "election_", "._", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "'", "election", "\\u", "tall", "ied", "'_", ",_", "{_", "'", "election", "'_", ":_", "election_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "encrypt", "ed", "\\u", "vote_", "=_", "request_", "._", "session_", "[_", "'", "encrypt", "ed", "\\u", "vote", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vote", "\\u", "fingerprint_", "=_", "crypto", "utils_", "._", "hash", "\\u", "b64", "_", "(_", "encrypt", "ed", "\\u", "vote_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "this", " ", "user", " ", "is", " ", "a", " ", "voter", ",", " ", "prepar", "e", " ", "some", " ", "stuff_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "voter", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vote_", "=_", "datatypes_", "._", "LD", "Object_", "._", "from", "Dict_", "(_", "utils_", "._", "from", "\\u", "json_", "(_", "encrypt", "ed", "\\u", "vote_", ")_", ",_", "type", "\\u", "hint_", "=_", "'", "lega", "cy", "/", "Encrypt", "ed", "Vote", "'_", ")_", "._", "wrapp", "ed", "\\u", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "prepar", "e", " ", "the", " ", "vote", " ", "to", " ", "cast_", "\\u\\u\\uNL\\u\\u\\u_", "cast", "\\u", "vote", "\\u", "params_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "vote", "'_", ":_", "vote_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "voter", "'_", ":_", "voter", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "vote", "\\u", "hash", "'_", ":_", "vote", "\\u", "fingerprint_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cast", "\\u", "at", "'_", ":_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cast", "\\u", "vote_", "=_", "Cast", "Vote", "_", "(_", "**_", "cast", "\\u", "vote", "\\u", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cast", "\\u", "vote_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "\"", "GET", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "voter", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "past", "\\u", "votes_", "=_", "Cast", "Vote", "_", "._", "get", "\\u", "by", "\\u", "voter", "_", "(_", "voter", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "past", "\\u", "votes_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "past", "\\u", "votes_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "past", "\\u", "votes_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cast", "\\u", "vote_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "issues_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "issues_", "=_", "cast", "\\u", "vote_", "._", "issues_", "(_", "election_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "issues_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bad", "\\u", "voter", "\\u", "login_", "=_", "(_", "request_", "._", "GET_", "._", "get_", "(_", "'", "bad", "\\u", "voter", "\\u", "login", "'_", ",_", "\"", "0", "\"_", ")_", "==_", "\"", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "status", " ", "update", " ", "this", " ", "vote_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "voter", "_", "and_", "voter", "_", "._", "user_", "._", "can", "\\u", "update", "\\u", "status_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status", "\\u", "update", "\\u", "label_", "=_", "voter", "_", "._", "user_", "._", "update", "\\u", "status", "\\u", "template_", "(_", ")_", "%_", "\"", "your", " ", "smart", " ", "ballot", " ", "track", "er", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status", "\\u", "update", "\\u", "message_", "=_", "\"", "I", " ", "vote", "d", " ", "in", " ", "%", "s", " ", "-", " ", "my", " ", "smart", " ", "track", "er", " ", "is", " ", "%", "s", "..", " ", "#", "heli", "os", "voting", "\"_", "%_", "(_", "get", "\\u", "election", "\\u", "url_", "(_", "election_", ")_", ",_", "cast", "\\u", "vote_", "._", "vote", "\\u", "hash_", "[_", ":_", "10_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status", "\\u", "update", "\\u", "label_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status", "\\u", "update", "\\u", "message_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "do", " ", "we", " ", "need", " ", "to", " ", "constrain", " ", "the", " ", "auth", "\\u", "system", "s", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "election_", "._", "eli", "gib", "ility_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "auth", "\\u", "systems_", "=_", "[_", "e_", "[_", "'", "auth", "\\u", "system", "'_", "]_", "for_", "e_", "in_", "election_", "._", "eli", "gib", "ility_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "auth", "\\u", "systems_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "password", "\\u", "only_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "auth", "\\u", "systems_", "==_", "None_", "or_", "'", "password", "'_", "in_", "auth", "\\u", "systems_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "show", "\\u", "password_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password", "\\u", "login", "\\u", "form_", "=_", "forms_", "._", "Vote", "r", "Passw", "ord", "Form_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "auth", "\\u", "systems_", "==_", "[_", "'", "password", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "password", "\\u", "only_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "show", "\\u", "password_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password", "\\u", "login", "\\u", "form_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return", "\\u", "url_", "=_", "reverse_", "(_", "one", "\\u", "election", "\\u", "cast", "\\u", "confirm_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "login", "\\u", "box_", "=_", "auth", "\\u", "views_", "._", "login", "\\u", "box", "\\u", "raw_", "(_", "request_", ",_", "return", "\\u", "url_", "=_", "return", "\\u", "url_", ",_", "auth", "\\u", "systems_", "=_", "auth", "\\u", "systems_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "'", "election", "\\u", "cast", "\\u", "confirm", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "login", "\\u", "box", "'_", ":_", "login", "\\u", "box_", ",_", "'", "election", "'_", ":_", "election_", ",_", "'", "vote", "\\u", "fingerprint", "'_", ":_", "vote", "\\u", "fingerprint_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "past", "\\u", "vote", "s", "'_", ":_", "past", "\\u", "votes_", ",_", "'", "issue", "s", "'_", ":_", "issues_", ",_", "'", "voter", "'_", ":_", "voter", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "return", "\\u", "url", "'_", ":_", "return", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "\\u", "update", "\\u", "label", "'_", ":_", "status", "\\u", "update", "\\u", "label_", ",_", "'", "status", "\\u", "update", "\\u", "message", "'_", ":_", "status", "\\u", "update", "\\u", "message_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "show", "\\u", "password", "'_", ":_", "show", "\\u", "password_", ",_", "'", "password", "\\u", "only", "'_", ":_", "password", "\\u", "only_", ",_", "'", "password", "\\u", "login", "\\u", "form", "'_", ":_", "password", "\\u", "login", "\\u", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bad", "\\u", "voter", "\\u", "login", "'_", ":_", "bad", "\\u", "voter", "\\u", "login_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "\"", "POST", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "csrf_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "voting", " ", "has", " ", "not", " ", "start", "ed", " ", "or", " ", "has", " ", "ended_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "not_", "election_", "._", "voting", "\\u", "has", "\\u", "started_", "(_", ")_", ")_", "or_", "election_", "._", "voting", "\\u", "has", "\\u", "stopped_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "URL", "\\u", "HOST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "user", " ", "is", " ", "not", " ", "logged", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bring", " ", "back", " ", "to", " ", "the", " ", "confirmation", " ", "page", " ", "to", " ", "let", " ", "him", " ", "know", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "voter", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "one", "\\u", "election", "\\u", "cast", "\\u", "confirm_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "store", " ", "the", " ", "vote", " ", "in", " ", "the", " ", "voter", "'", "s", " ", "data", " ", "structure", " ", "unti", "l", " ", "verification", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cast", "\\u", "vote_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "status", " ", "update", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "POST_", "._", "get_", "(_", "'", "status", "\\u", "update", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status", "\\u", "update", "\\u", "message_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "status", "\\u", "update", "\\u", "message", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status", "\\u", "update", "\\u", "message_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "launch", " ", "the", " ", "verification", " ", "task_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tasks_", "._", "cast", "\\u", "vote", "\\u", "verify", "\\u", "and", "\\u", "store_", "._", "delay_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "cast", "\\u", "vote", "\\u", "id_", "=_", "cast", "\\u", "vote_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status", "\\u", "update", "\\u", "message_", "=_", "status", "\\u", "update", "\\u", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", "the", " ", "vote", " ", "from", " ", "the", " ", "store_", "\\u\\u\\uNL\\u\\u\\u_", "del_", "request_", "._", "session_", "[_", "'", "encrypt", "ed", "\\u", "vote", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "\"%", "s", "%", "s", "\"_", "%_", "(_", "settings_", "._", "URL", "\\u", "HOST_", ",_", "reverse_", "(_", "one", "\\u", "election", "\\u", "cast", "\\u", "done_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "one", "\\u", "election", "\\u", "cast", "\\u", "done_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Thi", "s", " ", "view", " ", "need", "s", " ", "to", " ", "be", " ", "load", "ed", " ", "bec", "aus", "e", " ", "of", " ", "the", " ", "IF", "RAM", "E", ",", " ", "but", " ", "then", " ", "this", " ", "caus", "es", " ", "\\", "10", ";", " ", " ", "problem", "s", " ", "if", " ", "some", "one", " ", "clicks", " ", "\"", "relo", "ad", "\".", " ", "So", " ", "we", " ", "need", " ", "a", " ", "strat", "eg", "y", ".", "\\", "10", ";", " ", " ", "We", " ", "store", " ", "the", " ", "ballot", " ", "hash", " ", "in", " ", "the", " ", "session", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "get", "\\u", "user_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "voter", "_", "=_", "get", "\\u", "voter", "_", "(_", "request_", ",_", "user_", ",_", "election_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "voter", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "votes_", "=_", "Cast", "Vote", "_", "._", "get", "\\u", "by", "\\u", "voter", "_", "(_", "voter", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vote", "\\u", "hash_", "=_", "votes_", "[_", "0_", "]_", "._", "vote", "\\u", "hash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv", "\\u", "url_", "=_", "get", "\\u", "cast", "vote", "\\u", "url_", "(_", "votes_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "only", " ", "log", " ", "out", " ", "if", " ", "the", " ", "setti", "ng", " ", "say", "s", " ", "so", " ", "*", "and", "*", " ", "we", "'", "re", " ", "deal", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "a", " ", "site", "-", "wide", " ", "voter", ".", " ", "Definit", "el", "y", " ", "remove", " ", "current", "\\u", "voter", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "voter", "_", "._", "user_", "==_", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logout_", "=_", "settings_", "._", "LOGO", "UT\\u", "ON", "\\u", "CONFIRM", "ATION_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logout_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "request_", "._", "session_", "[_", "'", "CURREN", "T", "\\u", "VO", "TER", "\\u", "ID", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "save", "\\u", "in", "\\u", "session", "\\u", "acro", "ss", "\\u", "logo", "uts", "_", "(_", "request_", ",_", "'", "last", "\\u", "vote", "\\u", "hash", "'_", ",_", "vote", "\\u", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "\\u", "in", "\\u", "session", "\\u", "acro", "ss", "\\u", "logo", "uts", "_", "(_", "request_", ",_", "'", "last", "\\u", "vote", "\\u", "cv", "\\u", "url", "'_", ",_", "cv", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vote", "\\u", "hash_", "=_", "request_", "._", "session_", "[_", "'", "last", "\\u", "vote", "\\u", "hash", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv", "\\u", "url_", "=_", "request_", "._", "session_", "[_", "'", "last", "\\u", "vote", "\\u", "cv", "\\u", "url", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logout_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "local", " ", "logo", "ut", " ", "ensure", "s", " ", "tha", "t", " ", "there", "'", "s", " ", "no", " ", "more_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "user", " ", "local", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WH", "Y", " ", "DO", " ", "WE", " ", "COMMENT", " ", "THIS", " ", "OUT", "?", " ", "bec", "aus", "e", " ", "we", " ", "want", " ", "to", " ", "force", " ", "a", " ", "full", " ", "logo", "ut", " ", "via", " ", "the", " ", "iframe", ",", " ", "inclu", "ding_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "remote", " ", "system", "s", ",", " ", "just", " ", "in", " ", "case", ",", " ", "i", ".", "e", ".", " ", "CAS", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "logo", "ut", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "auth", "\\u", "views", ".", "do", "\\u", "local", "\\u", "logo", "ut", "(", "request", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remote", " ", "logo", "ut", " ", "is", " ", "happ", "eni", "ng", " ", "async", "hronous", "ly", " ", "in", " ", "an", " ", "iframe", " ", "to", " ", "be", " ", "modula", "r", " ", "give", "n", " ", "the", " ", "logo", "ut", " ", "mechanism", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "include", "\\u", "user", " ", "is", " ", "set", " ", "to", " ", "Fal", "se", " ", "if", " ", "logo", "ut", " ", "is", " ", "happ", "eni", "ng_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "'", "cast", "\\u", "don", "e", "'_", ",_", "{_", "'", "election", "'_", ":_", "election_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "vote", "\\u", "hash", "'_", ":_", "vote", "\\u", "hash_", ",_", "'", "logo", "ut", "'_", ":_", "logout_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "user_", "=_", "(_", "not_", "logout_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "return", "\\u", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "one", "\\u", "election", "\\u", "result_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "election_", "._", "result", "\\u", "released", "\\u", "at_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Permi", "ssion", "Denied_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "election_", "._", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "return", "\\u", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "one", "\\u", "election", "\\u", "result", "\\u", "proof", "_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "election_", "._", "result", "\\u", "released", "\\u", "at_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Permi", "ssion", "Denied_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "election_", "._", "result", "\\u", "proof", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", "frozen_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "one", "\\u", "election", "\\u", "bb", "oard", "_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "UI", " ", "to", " ", "show", " ", "election", " ", "bb", "oard", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "after_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "after", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", "=_", "int_", "(_", "request_", "._", "GET_", "._", "get_", "(_", "'", "offset", "'_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "limit_", "=_", "int_", "(_", "request_", "._", "GET_", "._", "get_", "(_", "'", "limit", "'_", ",_", "50_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "order", "\\u", "by_", "=_", "'", "voter", "\\u", "id", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unl", "ess", " ", "it", "'", "s", " ", "by", " ", "alias", ",", " ", "in", " ", "whi", "ch", " ", "case", " ", "we", " ", "bett", "er", " ", "go", " ", "by", " ", "UUID_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "election_", "._", "use", "\\u", "voter", "\\u", "aliases_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "by_", "=_", "'", "alias", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "there", "'", "s", " ", "a", " ", "specific", " ", "voter", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "GET_", "._", "has", "\\u", "key_", "(_", "'", "q", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "figure", " ", "out", " ", "the", " ", "voter", " ", "by", " ", "voter", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "voter", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "load", " ", "a", " ", "bunch", " ", "of", " ", "voter", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "voter", "s_", "=_", "Vote", "r_", "._", "get", "\\u", "by", "\\u", "election_", "(_", "election_", ",_", "after_", "=_", "after_", ",_", "limit_", "=_", "limit_", "+_", "1_", ",_", "order", "\\u", "by_", "=_", "order", "\\u", "by_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "more", "\\u", "p_", "=_", "len_", "(_", "voter", "s_", ")_", ">_", "limit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "more", "\\u", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "voter", "s_", "=_", "voter", "s_", "[_", "0_", ":_", "limit_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "\\u", "after_", "=_", "getattr_", "(_", "voter", "s_", "[_", "limit_", "-_", "1_", "]_", ",_", "order", "\\u", "by_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "after_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "'", "election", "\\u", "bb", "oard", "'_", ",_", "{_", "'", "election", "'_", ":_", "election_", ",_", "'", "voter", "s", "'_", ":_", "voter", "s_", ",_", "'", "next", "\\u", "after", "'_", ":_", "next", "\\u", "after_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "offset", "'_", ":_", "offset_", ",_", "'", "limit", "'_", ":_", "limit_", ",_", "'", "offset", "\\u", "plus", "\\u", "one", "'_", ":_", "offset_", "+_", "1_", ",_", "'", "offset", "\\u", "plus", "\\u", "limit", "'_", ":_", "offset_", "+_", "limit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "voter", "\\u", "id", "'_", ":_", "request_", "._", "GET_", "._", "get_", "(_", "'", "voter", "\\u", "id", "'_", ",_", "''_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", "frozen_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "one", "\\u", "election", "\\u", "audit", "ed", "\\u", "ballot", "s_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "UI", " ", "to", " ", "show", " ", "election", " ", "audit", "ed", " ", "ballot", "s", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "GET_", "._", "has", "\\u", "key_", "(_", "'", "vote", "\\u", "hash", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b_", "=_", "Audi", "ted", "Ball", "ot_", "._", "get_", "(_", "election_", ",_", "request_", "._", "GET_", "[_", "'", "vote", "\\u", "hash", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "b_", "._", "raw", "\\u", "vote_", ",_", "mimetype_", "=_", "\"", "text", "/", "plain", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "after_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "after", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", "=_", "int_", "(_", "request_", "._", "GET_", "._", "get_", "(_", "'", "offset", "'_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "limit_", "=_", "int_", "(_", "request_", "._", "GET_", "._", "get_", "(_", "'", "limit", "'_", ",_", "50_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "audit", "ed", "\\u", "ballot", "s_", "=_", "Audi", "ted", "Ball", "ot_", "._", "get", "\\u", "by", "\\u", "election_", "(_", "election_", ",_", "after_", "=_", "after_", ",_", "limit_", "=_", "limit_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "more", "\\u", "p_", "=_", "len_", "(_", "audit", "ed", "\\u", "ballot", "s_", ")_", ">_", "limit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "more", "\\u", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "audit", "ed", "\\u", "ballot", "s_", "=_", "audit", "ed", "\\u", "ballot", "s_", "[_", "0_", ":_", "limit_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "\\u", "after_", "=_", "audit", "ed", "\\u", "ballot", "s_", "[_", "limit_", "-_", "1_", "]_", "._", "vote", "\\u", "hash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "after_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "'", "election", "\\u", "audit", "ed", "\\u", "ballot", "s", "'_", ",_", "{_", "'", "election", "'_", ":_", "election_", ",_", "'", "audit", "ed", "\\u", "ballot", "s", "'_", ":_", "audit", "ed", "\\u", "ballot", "s_", ",_", "'", "next", "\\u", "after", "'_", ":_", "next", "\\u", "after_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "offset", "'_", ":_", "offset_", ",_", "'", "limit", "'_", ":_", "limit_", ",_", "'", "offset", "\\u", "plus", "\\u", "one", "'_", ":_", "offset_", "+_", "1_", ",_", "'", "offset", "\\u", "plus", "\\u", "limit", "'_", ":_", "offset_", "+_", "limit_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "admin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "voter", "\\u", "delete_", "(_", "request_", ",_", "election_", ",_", "voter", "\\u", "uuid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Tw", "o", " ", "condition", "s", " ", "under", " ", "whi", "ch", " ", "a", " ", "voter", " ", "can", " ", "be", " ", "delete", "d", ":", "\\", "10", ";", " ", " ", "-", " ", "election", " ", "is", " ", "not", " ", "frozen", " ", "or", "\\", "10", ";", " ", " ", "-", " ", "election", " ", "is", " ", "open", " ", "reg", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "FOR", " ", "NOW", " ", "we", " ", "allow", " ", "this", " ", "to", " ", "see", " ", "if", " ", "we", " ", "can", " ", "rede", "fine", " ", "the", " ", "meaning", " ", "of", " ", "\"", "close", "d", " ", "reg", "\"", " ", "to", " ", "be", " ", "more", " ", "flexib", "le_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "election", " ", "is", " ", "frozen", " ", "and", " ", "has", " ", "close", "d", " ", "registration_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "election", ".", "frozen", "\\u", "at", " ", "and", " ", "(", "not", " ", "election", ".", "open", "reg", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "raise", " ", "Permi", "ssion", "Den", "ied", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "election_", "._", "encrypt", "ed", "\\u", "tally", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Permi", "ssion", "Denied_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "voter", "_", "=_", "Vote", "r_", "._", "get", "\\u", "by", "\\u", "election", "\\u", "and", "\\u", "uuid_", "(_", "election_", ",_", "voter", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "voter", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "voter", "_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "election_", "._", "frozen", "\\u", "at_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "log", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "election_", "._", "append", "\\u", "log_", "(_", "\"", "Vote", "r", " ", "%", "s", "/", "%", "s", " ", "remove", "d", " ", "after", " ", "election", " ", "frozen", "\"_", "%_", "(_", "voter", "_", "._", "voter", "\\u", "type_", ",_", "voter", "_", "._", "voter", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "voter", "s", "\\u", "list", "\\u", "pretty_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "admin_", "(_", "frozen_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "one", "\\u", "election", "\\u", "set\\u", "reg_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Set", " ", "whe", "ther", " ", "this", " ", "is", " ", "open", " ", "registration", " ", "or", " ", "not", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "only", " ", "allow", " ", "this", " ", "for", " ", "public", " ", "election", "s_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "election_", "._", "private", "\\u", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "open", "\\u", "p_", "=_", "bool_", "(_", "int_", "(_", "request_", "._", "GET_", "[_", "'", "open", "\\u", "p", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "election_", "._", "open", "reg_", "=_", "open", "\\u", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "election_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "voter", "s", "\\u", "list", "\\u", "pretty_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "admin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "one", "\\u", "election", "\\u", "set\\u", "feature", "d_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Set", " ", "whe", "ther", " ", "this", " ", "is", " ", "a", " ", "feature", "d", " ", "election", " ", "or", " ", "not", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "get", "\\u", "user_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "security_", "._", "user", "\\u", "can", "\\u", "feature", "\\u", "election_", "(_", "user_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Permi", "ssion", "Denied_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "feature", "d\\u", "p_", "=_", "bool_", "(_", "int_", "(_", "request_", "._", "GET_", "[_", "'", "feature", "d\\u", "p", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "election_", "._", "feature", "d\\u", "p_", "=_", "feature", "d\\u", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "election_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "one", "\\u", "election", "\\u", "view_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "admin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "one", "\\u", "election", "\\u", "archive_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "archive", "\\u", "p_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "archive", "\\u", "p", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bool_", "(_", "int_", "(_", "archive", "\\u", "p_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "election_", "._", "archived", "\\u", "at_", "=_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "election_", "._", "archived", "\\u", "at_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "election_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "one", "\\u", "election", "\\u", "view_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "one", "\\u", "election", "\\u", "questions_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "question", "s", "\\u", "json_", "=_", "utils_", "._", "to", "\\u", "json_", "(_", "election_", "._", "questions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "get", "\\u", "user_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin", "\\u", "p_", "=_", "security_", "._", "user", "\\u", "can", "\\u", "admin", "\\u", "election_", "(_", "user_", ",_", "election_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "'", "election", "\\u", "question", "s", "'_", ",_", "{_", "'", "election", "'_", ":_", "election_", ",_", "'", "question", "s", "\\u", "json", "'_", ":_", "question", "s", "\\u", "json_", ",_", "'", "admin", "\\u", "p", "'_", ":_", "admin", "\\u", "p_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "eli", "gib", "ility_", "(_", "election_", ",_", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "prevent", " ", "password", "-", "users", " ", "from", " ", "signin", "g", " ", "up", " ", "will", "y", "-", "nil", "ly", " ", "for", " ", "other", " ", "election", "s", ",", " ", "doe", "sn", "'", "t", " ", "make", " ", "sense_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "user_", "._", "user", "\\u", "type_", "==_", "'", "password", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "election_", "._", "user", "\\u", "eligible", "\\u", "p_", "(_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "register", "\\u", "voter", "_", "(_", "election_", ",_", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "\\u", "check", "\\u", "eli", "gib", "ility_", "(_", "election_", ",_", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Vote", "r_", "._", "register", "\\u", "user", "\\u", "in", "\\u", "election_", "(_", "user_", ",_", "election_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "one", "\\u", "election", "\\u", "register_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "election_", "._", "open", "reg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Forbidden_", "(_", "'", "registration", " ", "is", " ", "close", "d", " ", "for", " ", "this", " ", "election", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check", "\\u", "csrf_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "get", "\\u", "user_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "voter", "_", "=_", "Vote", "r_", "._", "get", "\\u", "by", "\\u", "election", "\\u", "and", "\\u", "user_", "(_", "election_", ",_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "voter", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "voter", "_", "=_", "\\u", "register", "\\u", "voter", "_", "(_", "election_", ",_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "one", "\\u", "election", "\\u", "view_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "admin_", "(_", "frozen_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "one", "\\u", "election", "\\u", "save", "\\u", "questions_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "csrf_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "election_", "._", "questions_", "=_", "utils_", "._", "from", "\\u", "json_", "(_", "request_", "._", "POST_", "[_", "'", "question", "s", "\\u", "json", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "election_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "alw", "ay", "s", " ", "a", " ", "machine", " ", "API_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "SUCCESS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "transaction_", "._", "atomic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "election", "\\u", "admin_", "(_", "frozen_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "one", "\\u", "election", "\\u", "freeze_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "figure", " ", "out", " ", "the", " ", "number", " ", "of", " ", "question", "s", " ", "and", " ", "trust", "ees", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "issues_", "=_", "election_", "._", "issue", "s", "\\u", "bef", "ore", "\\u", "freeze_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "\"", "GET", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "'", "election", "\\u", "freez", "e", "'_", ",_", "{_", "'", "election", "'_", ":_", "election_", ",_", "'", "issue", "s", "'_", ":_", "issues_", ",_", "'", "issue", "s", "\\u", "p", "'_", ":_", "len_", "(_", "issues_", ")_", ">_", "0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "csrf_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "election_", "._", "freeze_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "get", "\\u", "user_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "one", "\\u", "election", "\\u", "view_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "SUCCESS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "election", "\\u", "tally", "\\u", "type_", "(_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "q_", "in_", "election_", "._", "questions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "q_", "[_", "'", "tally", "\\u", "type", "'_", "]_", "!=_", "\"", "homo", "morphi", "c", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "admin_", "(_", "frozen_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "one", "\\u", "election", "\\u", "compute", "\\u", "tally", "_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "tally", "ing", " ", "is", " ", "don", "e", " ", "all", " ", "at", " ", "a", " ", "time", " ", "now", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "\\u", "check", "\\u", "election", "\\u", "tally", "\\u", "type_", "(_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "one", "\\u", "election", "\\u", "view_", ",_", "args_", "=_", "[_", "election_", "._", "election", "\\u", "id_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "\"", "GET", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "'", "election", "\\u", "compute", "\\u", "tally", "'_", ",_", "{_", "'", "election", "'_", ":_", "election_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check", "\\u", "csrf_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "election_", "._", "voting", "\\u", "ende", "d\\u", "at_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "election_", "._", "voting", "\\u", "ende", "d\\u", "at_", "=_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "election_", "._", "tally", "ing", "\\u", "start", "ed", "\\u", "at_", "=_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "election_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tasks_", "._", "election", "\\u", "compute", "\\u", "tally", "_", "._", "delay_", "(_", "election", "\\u", "id_", "=_", "election_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "one", "\\u", "election", "\\u", "view_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "trust", "ee", "\\u", "check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "trust", "ee", "\\u", "decrypt", "\\u", "and", "\\u", "prove", "_", "(_", "request_", ",_", "election_", ",_", "trust", "ee_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "\\u", "check", "\\u", "election", "\\u", "tally", "\\u", "type_", "(_", "election_", ")_", "or_", "election_", "._", "encrypt", "ed", "\\u", "tally", "_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "one", "\\u", "election", "\\u", "view_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "'", "trust", "ee", "\\u", "decrypt", "\\u", "and", "\\u", "prove", "'_", ",_", "{_", "'", "election", "'_", ":_", "election_", ",_", "'", "trust", "ee", "'_", ":_", "trust", "ee_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", "frozen_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "trust", "ee", "\\u", "upload", "\\u", "decrypt", "ion_", "(_", "request_", ",_", "election_", ",_", "trust", "ee", "\\u", "uuid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "\\u", "check", "\\u", "election", "\\u", "tally", "\\u", "type_", "(_", "election_", ")_", "or_", "election_", "._", "encrypt", "ed", "\\u", "tally", "_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "FAILURE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "trust", "ee_", "=_", "Trust", "ee_", "._", "get", "\\u", "by", "\\u", "election", "\\u", "and", "\\u", "uuid_", "(_", "election_", ",_", "trust", "ee", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "factor", "s", "\\u", "and", "\\u", "proof", "s_", "=_", "utils_", "._", "from", "\\u", "json_", "(_", "request_", "._", "POST_", "[_", "'", "factor", "s", "\\u", "and", "\\u", "proof", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "verify", " ", "the", " ", "decrypt", "ion", " ", "factors_", "\\u\\u\\uNL\\u\\u\\u_", "trust", "ee_", "._", "decrypt", "ion", "\\u", "factors_", "=_", "[_", "[_", "datatypes_", "._", "LD", "Object_", "._", "from", "Dict_", "(_", "factor_", ",_", "type", "\\u", "hint_", "=_", "'", "core", "/", "Big", "Integer", "'_", ")_", "._", "wrapp", "ed", "\\u", "obj_", "for_", "factor_", "in_", "one", "\\u", "q", "\\u", "factors_", "]_", "for_", "one", "\\u", "q", "\\u", "factors_", "in_", "factor", "s", "\\u", "and", "\\u", "proof", "s_", "[_", "'", "decrypt", "ion", "\\u", "factor", "s", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "each", " ", "proof", " ", "need", "s", " ", "to", " ", "be", " ", "deserialized_", "\\u\\u\\uNL\\u\\u\\u_", "trust", "ee_", "._", "decrypt", "ion", "\\u", "proof", "s_", "=_", "[_", "[_", "datatypes_", "._", "LD", "Object_", "._", "from", "Dict_", "(_", "proof", "_", ",_", "type", "\\u", "hint_", "=_", "'", "lega", "cy", "/", "EG", "ZK", "Pro", "of", "'_", ")_", "._", "wrapp", "ed", "\\u", "obj_", "for_", "proof", "_", "in_", "one", "\\u", "q", "\\u", "proof", "s_", "]_", "for_", "one", "\\u", "q", "\\u", "proof", "s_", "in_", "factor", "s", "\\u", "and", "\\u", "proof", "s_", "[_", "'", "decrypt", "ion", "\\u", "proof", "s", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "trust", "ee_", "._", "verify", "\\u", "decrypt", "ion", "\\u", "proof", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trust", "ee_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "send", " ", "a", " ", "note", " ", "to", " ", "admin_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "election_", "._", "admin_", "._", "send", "\\u", "message_", "(_", "\"%", "s", " ", "-", " ", "trust", "ee", " ", "partial", " ", "decrypt", "ion", "\"_", "%_", "election_", "._", "name_", ",_", "\"", "trust", "ee", " ", "%", "s", " ", "(%", "s", ")", " ", "did", " ", "thei", "r", " ", "partial", " ", "decrypt", "ion", ".\"_", "%_", "(_", "trust", "ee_", "._", "name_", ",_", "trust", "ee_", "._", "email_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ah", " ", "well_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "SUCCESS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "FAILURE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "admin_", "(_", "frozen_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "release", "\\u", "result_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "result", " ", "is", " ", "compute", "d", " ", "and", " ", "now", " ", "it", "'", "s", " ", "time", " ", "to", " ", "release", " ", "the", " ", "result", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "election", "\\u", "url_", "=_", "get", "\\u", "election", "\\u", "url_", "(_", "election_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "\"", "POST", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "csrf_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "election_", "._", "release", "\\u", "result_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "election_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "\"%", "s", "\"_", "%_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "one", "\\u", "election", "\\u", "view_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "just", " ", "viewin", "g", " ", "the", " ", "form", " ", "or", " ", "the", " ", "form", " ", "is", " ", "not", " ", "valid_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "'", "release", "\\u", "result", "'_", ",_", "{_", "'", "election", "'_", ":_", "election_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "admin_", "(_", "frozen_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "combin", "e\\u", "decrypt", "ions_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "combin", "e", " ", "trust", "ee", " ", "decrypt", "ion", "s", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "election", "\\u", "url_", "=_", "get", "\\u", "election", "\\u", "url_", "(_", "election_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "\"", "POST", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "csrf_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "election_", "._", "combin", "e\\u", "decrypt", "ions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "election_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "\"%", "s", "\"_", "%_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "one", "\\u", "election", "\\u", "view_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "just", " ", "viewin", "g", " ", "the", " ", "form", " ", "or", " ", "the", " ", "form", " ", "is", " ", "not", " ", "valid_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "'", "combin", "e\\u", "decrypt", "ion", "s", "'_", ",_", "{_", "'", "election", "'_", ":_", "election_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "admin_", "(_", "frozen_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "one", "\\u", "election", "\\u", "set\\u", "result", "\\u", "and", "\\u", "proof", "_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "election_", "._", "tally", "\\u", "type_", "!=_", "\"", "homo", "morphi", "c", "\"_", "or_", "election_", "._", "encrypt", "ed", "\\u", "tally", "_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "one", "\\u", "election", "\\u", "view_", ",_", "args_", "=_", "[_", "election_", "._", "election", "\\u", "id_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "check", " ", "csrf_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "election_", "._", "result_", "=_", "utils_", "._", "from", "\\u", "json_", "(_", "request_", "._", "POST_", "[_", "'", "result", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "election_", "._", "result", "\\u", "proof", "_", "=_", "utils_", "._", "from", "\\u", "json_", "(_", "request_", "._", "POST_", "[_", "'", "result", "\\u", "proof", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "election_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "get", "\\u", "user_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "one", "\\u", "election", "\\u", "view_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "SUCCESS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "voter", "s", "\\u", "list", "\\u", "pretty_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Show", " ", "the", " ", "list", " ", "of", " ", "voter", "s", "\\", "10", ";", " ", " ", "now", " ", "usi", "ng", " ", "Dj", "ang", "o", " ", "pagina", "tion", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "django", " ", "pagina", "tion", " ", "support_", "\\u\\u\\uNL\\u\\u\\u_", "page_", "=_", "int_", "(_", "request_", "._", "GET_", "._", "get_", "(_", "'", "page", "'_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "limit_", "=_", "int_", "(_", "request_", "._", "GET_", "._", "get_", "(_", "'", "limit", "'_", ",_", "50_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "q", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "order", "\\u", "by_", "=_", "'", "user", "\\u\\u", "user", "\\u", "id", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unl", "ess", " ", "it", "'", "s", " ", "by", " ", "alias", ",", " ", "in", " ", "whi", "ch", " ", "case", " ", "we", " ", "bett", "er", " ", "go", " ", "by", " ", "UUID_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "election_", "._", "use", "\\u", "voter", "\\u", "aliases_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "by_", "=_", "'", "alias", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "user_", "=_", "get", "\\u", "user_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin", "\\u", "p_", "=_", "security_", "._", "user", "\\u", "can", "\\u", "admin", "\\u", "election_", "(_", "user_", ",_", "election_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "categories_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eli", "gib", "ilit", "y", "\\u", "category", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "admin", "\\u", "p_", "and_", "can", "\\u", "list", "\\u", "categories_", "(_", "user_", "._", "user", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "categories_", "=_", "AUTH", "\\u", "SYSTEM", "S_", "[_", "user_", "._", "user", "\\u", "type_", "]_", "._", "list", "\\u", "categories_", "(_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eli", "gib", "ilit", "y", "\\u", "category", "\\u", "id_", "=_", "election_", "._", "eli", "gib", "ilit", "y", "\\u", "category", "\\u", "id_", "(_", "user_", "._", "user", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Auth", "entica", "tion", "Expire", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "user", "\\u", "rea", "uth_", "(_", "request_", ",_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "files", " ", "bei", "ng", " ", "processed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "voter", "\\u", "files_", "=_", "election_", "._", "voter", "file", "\\u", "set_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "load", " ", "a", " ", "bunch", " ", "of", " ", "voter", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "voter", "s", " ", "=", " ", "Vote", "r", ".", "get", "\\u", "by", "\\u", "election", "(", "election", ",", " ", "order", "\\u", "by", "=", "order", "\\u", "by", ")_", "\\u\\u\\uNL\\u\\u\\u_", "voter", "s_", "=_", "Vote", "r_", "._", "objects_", "._", "filter_", "(_", "election_", "=_", "election_", ")_", "._", "order", "\\u", "by_", "(_", "order", "\\u", "by_", ")_", "._", "defer_", "(_", "'", "vote", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "q_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "election_", "._", "use", "\\u", "voter", "\\u", "aliases_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "voter", "s_", "=_", "voter", "s_", "._", "filter_", "(_", "alias", "\\u\\u", "icontains_", "=_", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "voter", "s_", "=_", "voter", "s_", "._", "filter_", "(_", "voter", "\\u", "name", "\\u\\u", "icontains_", "=_", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "voter", "\\u", "paginator_", "=_", "Paginator_", "(_", "voter", "s_", ",_", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "voter", "s", "\\u", "page_", "=_", "voter", "\\u", "paginator_", "._", "page_", "(_", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "total", "\\u", "voter", "s_", "=_", "voter", "\\u", "paginator_", "._", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "'", "voter", "s", "\\u", "list", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "election", "'_", ":_", "election_", ",_", "'", "voter", "s", "\\u", "page", "'_", ":_", "voter", "s", "\\u", "page_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "voter", "s", "'_", ":_", "voter", "s", "\\u", "page_", "._", "object\\u", "list_", ",_", "'", "admin", "\\u", "p", "'_", ":_", "admin", "\\u", "p_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "\\u", "voter", "s", "'_", ":_", "heli", "os_", "._", "VO", "TER", "S", "\\u", "EMAIL_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "limit", "'_", ":_", "limit_", ",_", "'", "total", "\\u", "voter", "s", "'_", ":_", "total", "\\u", "voter", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "upload", "\\u", "p", "'_", ":_", "heli", "os_", "._", "VO", "TER", "S", "\\u", "UPLOAD", "_", ",_", "'", "q", "'_", ":_", "q_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "voter", "\\u", "files", "'_", ":_", "voter", "\\u", "files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "categor", "ies", "'_", ":_", "categories_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "eli", "gib", "ilit", "y", "\\u", "category", "\\u", "id", "'_", ":_", "eli", "gib", "ilit", "y", "\\u", "category", "\\u", "id_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "admin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "voter", "s", "\\u", "eli", "gib", "ility_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "set", " ", "eli", "gib", "ilit", "y", " ", "for", " ", "voter", "s", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "get", "\\u", "user_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "\"", "GET", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "shou", "ld", "n", "'", "t", " ", "happ", "en", ",", " ", "only", " ", "POST", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "now", ",", " ", "private", " ", "election", "s", " ", "cann", "ot", " ", "change", " ", "eli", "gib", "ility_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "election_", "._", "private", "\\u", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "voter", "s", "\\u", "list", "\\u", "pretty_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "eli", "gib", "ility_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "eli", "gib", "ility_", "=_", "request_", "._", "POST_", "[_", "'", "eli", "gib", "ilit", "y", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "eli", "gib", "ility_", "in_", "[_", "'", "open", "reg", "'_", ",_", "'", "limited", "reg", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "election_", "._", "open", "reg_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "eli", "gib", "ility_", "==_", "'", "close", "dre", "g", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "election_", "._", "open", "reg_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "eli", "gib", "ility_", "==_", "'", "limited", "reg", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "now", " ", "process", " ", "the", " ", "constraint_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "category", "\\u", "id_", "=_", "request_", "._", "POST_", "[_", "'", "category", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "constraint_", "=_", "AUTH", "\\u", "SYSTEM", "S_", "[_", "user_", "._", "user", "\\u", "type_", "]_", "._", "generat", "e\\u", "constraint_", "(_", "category", "\\u", "id_", ",_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "election_", "._", "eli", "gib", "ility_", "=_", "[_", "{_", "'", "auth", "\\u", "system", "'_", ":_", "user_", "._", "user", "\\u", "type_", ",_", "'", "constraint", "'_", ":_", "[_", "constraint_", "]_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "election_", "._", "eli", "gib", "ility_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "election_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "voter", "s", "\\u", "list", "\\u", "pretty_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "admin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "voter", "s", "\\u", "upload_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Upload", " ", "a", " ", "CSV", " ", "of", " ", "password", "-", "based", " ", "voter", "s", " ", "with", "\\", "10", ";", " ", " ", "voter", "\\u", "id", ",", " ", "email", ",", " ", "name", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", "name", " ", "and", " ", "email", " ", "are", " ", "need", "ed", " ", "only", " ", "if", " ", "voter", "\\u", "type", " ", "is", " ", "static", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "TR", "YI", "NG", " ", "this", ":", " ", "allow", "ing", " ", "voter", "s", " ", "upload", " ", "by", " ", "admin", " ", "whe", "n", " ", "election", " ", "is", " ", "frozen_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "election", ".", "frozen", "\\u", "at", " ", "and", " ", "not", " ", "election", ".", "open", "reg", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "raise", " ", "Permi", "ssion", "Den", "ied", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "\"", "GET", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "'", "voter", "s", "\\u", "upload", "'_", ",_", "{_", "'", "election", "'_", ":_", "election_", ",_", "'", "error", "'_", ":_", "request_", "._", "GET_", "._", "get_", "(_", "'", "e", "'_", ",_", "None_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "\"", "POST", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "bool_", "(_", "request_", "._", "POST_", "._", "get_", "(_", "'", "confirm", "\\u", "p", "'_", ",_", "0_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "launch", " ", "the", " ", "background", " ", "task", " ", "to", " ", "parse", " ", "tha", "t", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tasks_", "._", "voter", "\\u", "file", "\\u", "process_", "._", "delay_", "(_", "voter", "\\u", "file", "\\u", "id_", "=_", "request_", "._", "session_", "[_", "'", "voter", "\\u", "file", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "request_", "._", "session_", "[_", "'", "voter", "\\u", "file", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "voter", "s", "\\u", "list", "\\u", "pretty_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "need", " ", "to", " ", "confirm_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "FILES_", "._", "has", "\\u", "key_", "(_", "'", "voter", "s", "\\u", "file", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "voter", "s", "\\u", "file_", "=_", "request_", "._", "FILES_", "[_", "'", "voter", "s", "\\u", "file", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "voter", "\\u", "file", "\\u", "obj_", "=_", "election_", "._", "add", "\\u", "voter", "s", "\\u", "file_", "(_", "voter", "s", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "session_", "[_", "'", "voter", "\\u", "file", "\\u", "id", "'_", "]_", "=_", "voter", "\\u", "file", "\\u", "obj_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "problems_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", " ", "the", " ", "first", " ", "few", " ", "lines", " ", "to", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "voter", "s_", "=_", "[_", "v_", "for_", "v_", "in_", "voter", "\\u", "file", "\\u", "obj_", "._", "iter", "voter", "s_", "(_", ")_", "]_", "[_", ":_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "voter", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "problems_", "._", "append_", "(_", "\"", "your", " ", "CSV", " ", "file", " ", "coul", "d", " ", "not", " ", "be", " ", "process", "ed", ".", " ", "Ple", "ase", " ", "check", " ", "tha", "t", " ", "it", " ", "is", " ", "a", " ", "proper", " ", "CSV", " ", "file", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "voter", " ", "email", "s", " ", "look", " ", "like", " ", "emails_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "False_", "in_", "[_", "validat", "e\\u", "email_", "(_", "v_", "[_", "'", "email", "'_", "]_", ")_", "for_", "v_", "in_", "voter", "s_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "problems_", "._", "append_", "(_", "\"", "tho", "se", " ", "don", "'", "t", " ", "look", " ", "like", " ", "correct", " ", "email", " ", "addresse", "s", ".", " ", "Are", " ", "you", " ", "sure", " ", "you", " ", "uploade", "d", " ", "a", " ", "file", " ", "with", " ", "email", " ", "address", " ", "as", " ", "second", " ", "field", "?\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "'", "voter", "s", "\\u", "upload", "\\u", "confirm", "'_", ",_", "{_", "'", "election", "'_", ":_", "election_", ",_", "'", "voter", "s", "'_", ":_", "voter", "s_", ",_", "'", "problem", "s", "'_", ":_", "problems_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "\"%", "s", "?", "%", "s", "\"_", "%_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "voter", "s", "\\u", "upload_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ",_", "urllib_", "._", "urlencode_", "(_", "{_", "'", "e", "'_", ":_", "'", "no", " ", "voter", " ", "file", " ", "specified", ",", " ", "try", " ", "again", "'_", "}_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "admin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "voter", "s", "\\u", "upload", "\\u", "cancel_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "cancel", " ", "upload", " ", "of", " ", "CSV", " ", "file", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "voter", "\\u", "file", "\\u", "id_", "=_", "request_", "._", "session_", "._", "get_", "(_", "'", "voter", "\\u", "file", "\\u", "id", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "voter", "\\u", "file", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vf_", "=_", "Vote", "r", "File_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "voter", "\\u", "file", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vf_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "request_", "._", "session_", "[_", "'", "voter", "\\u", "file", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "one", "\\u", "election", "\\u", "view_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "admin_", "(_", "frozen_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "voter", "s", "\\u", "email_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "heli", "os_", "._", "VO", "TER", "S", "\\u", "EMAIL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "one", "\\u", "election", "\\u", "view_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "TEMPLATES_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "vote", "'_", ",_", "'", "Time", " ", "to", " ", "Vote", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "simple", "'_", ",_", "'", "Simple", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "info", "'_", ",_", "'", "Addition", "al", " ", "Info", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "result", "'_", ",_", "'", "Elect", "ion", " ", "Result", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "template_", "=_", "request_", "._", "REQUEST_", "._", "get_", "(_", "'", "template", "'_", ",_", "'", "vote", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "template_", "in_", "[_", "t_", "[_", "0_", "]_", "for_", "t_", "in_", "TEMPLATES_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "bad", " ", "template", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "voter", "\\u", "id_", "=_", "request_", "._", "REQUEST_", "._", "get_", "(_", "'", "voter", "\\u", "id", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "voter", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "voter", "_", "=_", "Vote", "r_", "._", "get", "\\u", "by", "\\u", "election", "\\u", "and", "\\u", "voter", "\\u", "id_", "(_", "election_", ",_", "voter", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "voter", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "election", "\\u", "url_", "=_", "get", "\\u", "election", "\\u", "url_", "(_", "election_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "election", "\\u", "vote", "\\u", "url_", "=_", "get", "\\u", "election", "\\u", "gov", "ote", "\\u", "url_", "(_", "election_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "subject_", "=_", "render", "\\u", "template", "\\u", "raw_", "(_", "None_", ",_", "'", "email", "/", "%", "s", "\\u", "subject", ".", "txt", "'_", "%_", "template_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "custom", "\\u", "subject", "'_", ":_", "\"&", "lt", ";", "SUBJECT", "&", "gt", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "body_", "=_", "render", "\\u", "template", "\\u", "raw_", "(_", "None_", ",_", "'", "email", "/", "%", "s", "\\u", "body", ".", "txt", "'_", "%_", "template_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "election", "'_", ":_", "election_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "election", "\\u", "url", "'_", ":_", "election", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "election", "\\u", "vote", "\\u", "url", "'_", ":_", "election", "\\u", "vote", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "custom", "\\u", "subject", "'_", ":_", "default", "\\u", "subject_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "custom", "\\u", "message", "'_", ":_", "'&", "lt", ";", "BODY", "&", "gt", ";'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "voter", "'_", ":_", "{_", "'", "vote", "\\u", "hash", "'_", ":_", "'<", "SMA", "RT", "\\u", "TRACK", "ER", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'<", "VO", "TER", "\\u", "NAME", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "voter", "\\u", "login", "\\u", "id", "'_", ":_", "'<", "VO", "TER", "\\u", "LOGIN", "\\u", "ID", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "voter", "\\u", "password", "'_", ":_", "'<", "VO", "TER", "\\u", "PASS", "WORD", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "voter", "\\u", "type", "'_", ":_", "election_", "._", "voter", "\\u", "set_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "._", "voter", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "election", "'_", ":_", "election_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "\"", "GET", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "email", "\\u", "form_", "=_", "forms_", "._", "Ema", "il", "Vote", "rs", "Form_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "voter", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "email", "\\u", "form_", "._", "fields_", "[_", "'", "send", "\\u", "to", "'_", "]_", "._", "widget_", "=_", "email", "\\u", "form_", "._", "fields_", "[_", "'", "send", "\\u", "to", "'_", "]_", "._", "hidden", "\\u", "widget_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "email", "\\u", "form_", "=_", "forms_", "._", "Ema", "il", "Vote", "rs", "Form_", "(_", "request_", "._", "POST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "email", "\\u", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "client", " ", "knows", " ", "to", " ", "submit", " ", "only", " ", "onc", "e", " ", "with", " ", "a", " ", "specific", " ", "voter", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subject", "\\u", "template_", "=_", "'", "email", "/", "%", "s", "\\u", "subject", ".", "txt", "'_", "%_", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body", "\\u", "template_", "=_", "'", "email", "/", "%", "s", "\\u", "body", ".", "txt", "'_", "%_", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "\\u", "vars_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "custom", "\\u", "subject", "'_", ":_", "email", "\\u", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "subject", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "custom", "\\u", "message", "'_", ":_", "email", "\\u", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "body", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "election", "\\u", "vote", "\\u", "url", "'_", ":_", "election", "\\u", "vote", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "election", "\\u", "url", "'_", ":_", "election", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "election", "'_", ":_", "election_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "voter", "\\u", "constraint", "s", "\\u", "include_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "voter", "\\u", "constraint", "s", "\\u", "exclude_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "voter", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tasks_", "._", "single", "\\u", "voter", "\\u", "email_", "._", "delay_", "(_", "voter", "\\u", "uuid_", "=_", "voter", "_", "._", "uuid_", ",_", "subject", "\\u", "template_", "=_", "subject", "\\u", "template_", ",_", "body", "\\u", "template_", "=_", "body", "\\u", "template_", ",_", "extra", "\\u", "vars_", "=_", "extra", "\\u", "vars_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "exclu", "de", " ", "tho", "se", " ", "who", " ", "have", " ", "not", " ", "vote", "d_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "email", "\\u", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "send", "\\u", "to", "'_", "]_", "==_", "'", "vote", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "voter", "\\u", "constraint", "s", "\\u", "exclude_", "=_", "{_", "'", "vote", "\\u", "hash", "'_", ":_", "None_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "include", " ", "only", " ", "tho", "se", " ", "who", " ", "have", " ", "not", " ", "vote", "d_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "email", "\\u", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "send", "\\u", "to", "'_", "]_", "==_", "'", "not", "-", "vote", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "voter", "\\u", "constraint", "s", "\\u", "include_", "=_", "{_", "'", "vote", "\\u", "hash", "'_", ":_", "None_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tasks_", "._", "voter", "s", "\\u", "email_", "._", "delay_", "(_", "election", "\\u", "id_", "=_", "election_", "._", "id_", ",_", "subject", "\\u", "template_", "=_", "subject", "\\u", "template_", ",_", "body", "\\u", "template_", "=_", "body", "\\u", "template_", ",_", "extra", "\\u", "vars_", "=_", "extra", "\\u", "vars_", ",_", "voter", "\\u", "constraint", "s", "\\u", "include_", "=_", "voter", "\\u", "constraint", "s", "\\u", "include_", ",_", "voter", "\\u", "constraint", "s", "\\u", "exclude_", "=_", "voter", "\\u", "constraint", "s", "\\u", "exclude_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "batch", " ", "process", " ", "is", " ", "all", " ", "async", ",", " ", "so", " ", "we", " ", "can", " ", "return", " ", "a", " ", "nice", " ", "note_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "settings_", "._", "SECU", "RE", "\\u", "URL", "\\u", "HOST_", "+_", "reverse_", "(_", "one", "\\u", "election", "\\u", "view_", ",_", "args_", "=_", "[_", "election_", "._", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "request_", ",_", "\"", "voter", "s", "\\u", "email", "\"_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "\\u", "form", "'_", ":_", "email", "\\u", "form_", ",_", "'", "election", "'_", ":_", "election_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "voter", "'_", ":_", "voter", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "\\u", "subject", "'_", ":_", "default", "\\u", "subject_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "\\u", "body", "'_", ":_", "default", "\\u", "body_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "template", "'_", ":_", "template_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "template", "s", "'_", ":_", "TEMPLATES_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "return", "\\u", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "voter", "\\u", "list_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "normali", "ze", " ", "limit_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "limit_", "=_", "int_", "(_", "request_", "._", "GET_", "._", "get_", "(_", "'", "limit", "'_", ",_", "500_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "limit_", ">_", "500_", ":_", "limit_", "=_", "500_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "voter", "s_", "=_", "Vote", "r_", "._", "get", "\\u", "by", "\\u", "election_", "(_", "election_", ",_", "order", "\\u", "by_", "=_", "'", "uuid", "'_", ",_", "after_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "after", "'_", ",_", "None_", ")_", ",_", "limit_", "=_", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "v_", "._", "ld", "\\u", "object_", "._", "to", "Dict_", "(_", ")_", "for_", "v_", "in_", "voter", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "return", "\\u", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "one", "\\u", "voter", "_", "(_", "request_", ",_", "election_", ",_", "voter", "\\u", "uuid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "View", " ", "a", " ", "single", " ", "voter", "'", "s", " ", "info", " ", "as", " ", "JSO", "N", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "voter", "_", "=_", "Vote", "r_", "._", "get", "\\u", "by", "\\u", "election", "\\u", "and", "\\u", "uuid_", "(_", "election_", ",_", "voter", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "voter", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "voter", "_", "._", "to", "JSO", "ND", "ict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "return", "\\u", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "voter", "\\u", "votes_", "(_", "request_", ",_", "election_", ",_", "voter", "\\u", "uuid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "all", " ", "cast", " ", "vote", "s", " ", "by", " ", "a", " ", "voter", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "voter", "_", "=_", "Vote", "r_", "._", "get", "\\u", "by", "\\u", "election", "\\u", "and", "\\u", "uuid_", "(_", "election_", ",_", "voter", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "votes_", "=_", "Cast", "Vote", "_", "._", "get", "\\u", "by", "\\u", "voter", "_", "(_", "voter", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "v_", "._", "to", "JSO", "ND", "ict_", "(_", ")_", "for_", "v_", "in_", "votes_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "return", "\\u", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "voter", "\\u", "last", "\\u", "vote_", "(_", "request_", ",_", "election_", ",_", "voter", "\\u", "uuid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "all", " ", "cast", " ", "vote", "s", " ", "by", " ", "a", " ", "voter", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "voter", "_", "=_", "Vote", "r_", "._", "get", "\\u", "by", "\\u", "election", "\\u", "and", "\\u", "uuid_", "(_", "election_", ",_", "voter", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "voter", "_", "._", "last", "\\u", "cast", "\\u", "vote_", "(_", ")_", "._", "to", "JSO", "ND", "ict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "election", "\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "return", "\\u", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "ballot", "\\u", "list_", "(_", "request_", ",_", "election_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "this", " ", "will", " ", "order", " ", "the", " ", "ballot", "s", " ", "from", " ", "most", " ", "recent", " ", "to", " ", "oldest", ".", "\\", "10", ";", " ", " ", "and", " ", "option", "ally", " ", "take", " ", "a", " ", "after", " ", "parameter", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "limit_", "=_", "after_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "GET_", "._", "has", "\\u", "key_", "(_", "'", "limit", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "limit_", "=_", "int_", "(_", "request_", "._", "GET_", "[_", "'", "limit", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "GET_", "._", "has", "\\u", "key_", "(_", "'", "after", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "after_", "=_", "datetime_", "._", "datetime_", "._", "strptime_", "(_", "request_", "._", "GET_", "[_", "'", "after", "'_", "]_", ",_", "'%", "Y", "-%", "m", "-%", "d", " ", "%", "H", ":", "%", "M", ":", "%", "S", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "voter", "s_", "=_", "Vote", "r_", "._", "get", "\\u", "by", "\\u", "election_", "(_", "election_", ",_", "cast_", "=_", "True_", ",_", "order", "\\u", "by_", "=_", "'", "cast", "\\u", "at", "'_", ",_", "limit_", "=_", "limit_", ",_", "after_", "=_", "after_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "explicit", "ly", " ", "cast", " ", "this", " ", "to", " ", "a", " ", "short", " ", "cast", " ", "vote_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "[_", "v_", "._", "last", "\\u", "cast", "\\u", "vote_", "(_", ")_", "._", "ld", "\\u", "object_", "._", "short_", "._", "to", "Dict_", "(_", "complete_", "=_", "True_", ")_", "for_", "v_", "in_", "voter", "s_", "]_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
ImageEngine/gaffer/python/GafferTest/SignalsTest.py
[ { "content": "\tdef testGroupingAndOrdering( self ) :\n\n\t\tvalues = []\n\t\tdef f( value ) :\n\n\t\t\tvalues.append( value )\n\n\t\ts = Gaffer.Signal0()\n\t\tc1 = s.connect( IECore.curry( f, \"one\" ) )\n\t\tc2 = s.connect( IECore.curry( f, \"two\" ) )\n\t\ts()\n\n\t\tself.assertEqual( values, [ \"one\", \"two\" ] )\n\n\t\tdel values[:]\n\n\t\tc1 = s.connect( 1, IECore.curry( f, \"one\" ) )\n\t\tc2 = s.connect( 0, IECore.curry( f, \"two\" ) )\n\t\ts()\n\n\t\tself.assertEqual( values, [ \"two\", \"one\" ] )\n\n\t\tdel values[:]\n\n\t\tc1 = s.connect( IECore.curry( f, \"one\" ) )\n\t\tc2 = s.connect( 0, IECore.curry( f, \"two\" ) )\n\t\ts()\n\n\t\tself.assertEqual( values, [ \"two\", \"one\" ] )", "metadata": "root.SignalsTest.testGroupingAndOrdering", "header": "['class', 'SignalsTest', '(', 'GafferTest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 313 } ]
[ { "span": "c1 ", "start_line": 321, "start_column": 2, "end_line": 321, "end_column": 4 }, { "span": "c2 ", "start_line": 322, "start_column": 2, "end_line": 322, "end_column": 4 }, { "span": "c1 ", "start_line": 329, "start_column": 2, "end_line": 329, "end_column": 4 }, { "span": "c2 ", "start_line": 330, "start_column": 2, "end_line": 330, "end_column": 4 } ]
[ { "span": "c1 ", "start_line": 337, "start_column": 2, "end_line": 337, "end_column": 4 }, { "span": "c2 ", "start_line": 338, "start_column": 2, "end_line": 338, "end_column": 4 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Signal", "s", "Test_", "(_", "Ga", "ffer", "Test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Group", "ing", "And", "Order", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "values_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "f_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "values_", "._", "append_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "Ga", "ffer", "_", "._", "Signal", "0_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c1_", "=_", "s_", "._", "connect_", "(_", "IE", "Core_", "._", "curr", "y_", "(_", "f_", ",_", "\"", "one", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c2_", "=_", "s_", "._", "connect_", "(_", "IE", "Core_", "._", "curr", "y_", "(_", "f_", ",_", "\"", "two", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "values_", ",_", "[_", "\"", "one", "\"_", ",_", "\"", "two", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "del_", "values_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c1_", "=_", "s_", "._", "connect_", "(_", "1_", ",_", "IE", "Core_", "._", "curr", "y_", "(_", "f_", ",_", "\"", "one", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c2_", "=_", "s_", "._", "connect_", "(_", "0_", ",_", "IE", "Core_", "._", "curr", "y_", "(_", "f_", ",_", "\"", "two", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "values_", ",_", "[_", "\"", "two", "\"_", ",_", "\"", "one", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "del_", "values_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c1_", "=_", "s_", "._", "connect_", "(_", "IE", "Core_", "._", "curr", "y_", "(_", "f_", ",_", "\"", "one", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c2_", "=_", "s_", "._", "connect_", "(_", "0_", ",_", "IE", "Core_", "._", "curr", "y_", "(_", "f_", ",_", "\"", "two", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "values_", ",_", "[_", "\"", "two", "\"_", ",_", "\"", "one", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
AppScale/appscale/AppServer/lib/django-0.96/django/db/backends/util.py
[ { "content": "def typecast_timestamp(s): # does NOT store time zone information\n # \"2005-07-29 15:48:00.590358-05\"\n # \"2005-07-29 09:56:00-05\"\n if not s: return None\n if not ' ' in s: return typecast_date(s)\n d, t = s.split()\n # Extract timezone information, if it exists. Currently we just throw\n # it away, but in the future we may make use of it.\n if '-' in t:\n t, tz = t.split('-', 1)\n tz = '-' + tz\n elif '+' in t:\n t, tz = t.split('+', 1)\n tz = '+' + tz\n else:\n tz = ''\n dates = d.split('-')\n times = t.split(':')\n seconds = times[2]\n if '.' in seconds: # check whether seconds have a fractional part\n seconds, microseconds = seconds.split('.')\n else:\n microseconds = '0'\n return datetime.datetime(int(dates[0]), int(dates[1]), int(dates[2]),\n int(times[0]), int(times[1]), int(seconds), int(float('.'+microseconds) * 1000000))", "metadata": "root.typecast_timestamp", "header": "['module', '___EOS___']", "index": 56 } ]
[ { "span": "tz ", "start_line": 66, "start_column": 8, "end_line": 66, "end_column": 10 }, { "span": "tz ", "start_line": 69, "start_column": 8, "end_line": 69, "end_column": 10 }, { "span": "tz ", "start_line": 71, "start_column": 8, "end_line": 71, "end_column": 10 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "typec", "ast", "\\u", "timestamp_", "(_", "s_", ")_", ":_", "#", " ", "doe", "s", " ", "NOT", " ", "store", " ", "time", " ", "zone", " ", "information_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "\"", "2005", "-0", "7", "-", "2", "9", " ", "15", ":", "4", "8", ":", "00", ".5", "903", "5", "8", "-0", "5", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "2005", "-0", "7", "-", "2", "9", " ", "09", ":", "56", ":", "00", "-0", "5", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "s_", ":_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "'", " ", "'_", "in_", "s_", ":_", "return_", "typec", "ast", "\\u", "date_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", ",_", "t_", "=_", "s_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Extract", " ", "timezon", "e", " ", "informati", "on", ",", " ", "if", " ", "it", " ", "exist", "s", ".", " ", "Curr", "ent", "ly", " ", "we", " ", "just", " ", "throw_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "awa", "y", ",", " ", "but", " ", "in", " ", "the", " ", "future", " ", "we", " ", "may", " ", "make", " ", "use", " ", "of", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'-'_", "in_", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", ",_", "tz_", "=_", "t_", "._", "split_", "(_", "'-'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tz_", "=_", "'-'_", "+_", "tz_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'+'_", "in_", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", ",_", "tz_", "=_", "t_", "._", "split_", "(_", "'+'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tz_", "=_", "'+'_", "+_", "tz_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tz_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dates_", "=_", "d_", "._", "split_", "(_", "'-'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "times_", "=_", "t_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seconds_", "=_", "times_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'.'_", "in_", "seconds_", ":_", "#", " ", "check", " ", "whe", "ther", " ", "second", "s", " ", "have", " ", "a", " ", "fractional", " ", "part_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "seconds_", ",_", "microseconds_", "=_", "seconds_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "microseconds_", "=_", "'", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "datetime_", "._", "datetime_", "(_", "int_", "(_", "dates_", "[_", "0_", "]_", ")_", ",_", "int_", "(_", "dates_", "[_", "1_", "]_", ")_", ",_", "int_", "(_", "dates_", "[_", "2_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "times_", "[_", "0_", "]_", ")_", ",_", "int_", "(_", "times_", "[_", "1_", "]_", ")_", ",_", "int_", "(_", "seconds_", ")_", ",_", "int_", "(_", "float_", "(_", "'.'_", "+_", "microseconds_", ")_", "*_", "1000000_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
mission-liao/pyswagger/pyswagger/tests/contrib/client/test_requests.py
[ { "content": " def test_uploadFile(self):\n \"\"\" Pet.uploadFile \"\"\"\n httpretty.register_uri(httpretty.POST, 'http://petstore.swagger.wordnik.com/api/pet/uploadImage',\n status=200)\n\n resp = client.request(app.op['uploadFile'](\n additionalMetadata='a test image', file=dict(data=six.StringIO('a test Content'), filename='test.txt')))\n\n self.assertEqual(resp.status, 200)\n\n body = httpretty.last_request().body.decode()\n self.assertTrue(body.find('additionalMetadata') != -1)\n self.assertTrue(body.find('a test image') != -1)\n self.assertTrue(body.find('file') != -1)\n self.assertTrue(body.find('a test Content') != -1)\n self.assertTrue(body.find('filename=\"test.txt\"') != -1)", "metadata": "root.RequestsClient_Pet_TestCase.test_uploadFile", "header": "['class', 'RequestsClient_Pet_TestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 152 } ]
[ { "span": "self.assertTrue(body.find('additionalMetadata') != -1)", "start_line": 163, "start_column": 8, "end_line": 163, "end_column": 62 }, { "span": "self.assertTrue(body.find('a test image') != -1)", "start_line": 164, "start_column": 8, "end_line": 164, "end_column": 56 }, { "span": "self.assertTrue(body.find('file') != -1)", "start_line": 165, "start_column": 8, "end_line": 165, "end_column": 48 }, { "span": "self.assertTrue(body.find('a test Content') != -1)", "start_line": 166, "start_column": 8, "end_line": 166, "end_column": 58 }, { "span": "self.assertTrue(body.find('filename=\"test.txt\"') != -1)", "start_line": 167, "start_column": 8, "end_line": 167, "end_column": 63 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Request", "s", "Client", "\\u", "Pet", "\\u", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "upload", "File_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Pet", ".", "upload", "File", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "httpretty_", "._", "register", "\\u", "uri_", "(_", "httpretty_", "._", "POST_", ",_", "'", "http", "://", "pets", "tore", ".", "swa", "gger", ".", "word", "nik", ".", "com", "/", "api", "/", "pet", "/", "upload", "Image", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "client_", "._", "request_", "(_", "app_", "._", "op_", "[_", "'", "upload", "File", "'_", "]_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "addition", "al", "Metadata_", "=_", "'", "a", " ", "test", " ", "image", "'_", ",_", "file_", "=_", "dict_", "(_", "data_", "=_", "six_", "._", "String", "IO_", "(_", "'", "a", " ", "test", " ", "Conten", "t", "'_", ")_", ",_", "filename_", "=_", "'", "test", ".", "txt", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "httpretty_", "._", "last", "\\u", "request_", "(_", ")_", "._", "body_", "._", "decode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "body_", "._", "find_", "(_", "'", "addition", "al", "Meta", "data", "'_", ")_", "!=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "body_", "._", "find_", "(_", "'", "a", " ", "test", " ", "image", "'_", ")_", "!=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "body_", "._", "find_", "(_", "'", "file", "'_", ")_", "!=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "body_", "._", "find_", "(_", "'", "a", " ", "test", " ", "Conten", "t", "'_", ")_", "!=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "body_", "._", "find_", "(_", "'", "filename", "=\"", "test", ".", "txt", "\"'_", ")_", "!=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Imprecise assert
AppScale/appscale/AppServer/lib/django-1.5/tests/modeltests/update_only_fields/tests.py
[ { "content": " def test_update_fields_signals(self):\n p = Person.objects.create(name='Sara', gender='F')\n pre_save_data = []\n def pre_save_receiver(**kwargs):\n pre_save_data.append(kwargs['update_fields'])\n pre_save.connect(pre_save_receiver)\n post_save_data = []\n def post_save_receiver(**kwargs):\n post_save_data.append(kwargs['update_fields'])\n post_save.connect(post_save_receiver)\n p.save(update_fields=['name'])\n self.assertEqual(len(pre_save_data), 1)\n self.assertEqual(len(pre_save_data[0]), 1)\n self.assertTrue('name' in pre_save_data[0])\n self.assertEqual(len(post_save_data), 1)\n self.assertEqual(len(post_save_data[0]), 1)\n self.assertTrue('name' in post_save_data[0])\n\n pre_save.disconnect(pre_save_receiver)\n post_save.disconnect(post_save_receiver)", "metadata": "root.UpdateOnlyFieldsTests.test_update_fields_signals", "header": "['class', 'UpdateOnlyFieldsTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 191 } ]
[ { "span": "self.assertTrue('name' in pre_save_data[0])", "start_line": 204, "start_column": 8, "end_line": 204, "end_column": 51 }, { "span": "self.assertTrue('name' in post_save_data[0])", "start_line": 207, "start_column": 8, "end_line": 207, "end_column": 52 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Update", "On", "ly", "Field", "s", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "update", "\\u", "fields", "\\u", "signals_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "Person_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "Sar", "a", "'_", ",_", "gender_", "=_", "'", "F", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pre", "\\u", "save", "\\u", "data_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "pre", "\\u", "save", "\\u", "receiver_", "(_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pre", "\\u", "save", "\\u", "data_", "._", "append_", "(_", "kwargs_", "[_", "'", "update", "\\u", "fields", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pre", "\\u", "save_", "._", "connect_", "(_", "pre", "\\u", "save", "\\u", "receiver_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "save", "\\u", "data_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "post", "\\u", "save", "\\u", "receiver_", "(_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "post", "\\u", "save", "\\u", "data_", "._", "append_", "(_", "kwargs_", "[_", "'", "update", "\\u", "fields", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "post", "\\u", "save_", "._", "connect_", "(_", "post", "\\u", "save", "\\u", "receiver_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "save_", "(_", "update", "\\u", "fields_", "=_", "[_", "'", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "pre", "\\u", "save", "\\u", "data_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "pre", "\\u", "save", "\\u", "data_", "[_", "0_", "]_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "name", "'_", "in_", "pre", "\\u", "save", "\\u", "data_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "post", "\\u", "save", "\\u", "data_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "post", "\\u", "save", "\\u", "data_", "[_", "0_", "]_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "name", "'_", "in_", "post", "\\u", "save", "\\u", "data_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pre", "\\u", "save_", "._", "disconnect_", "(_", "pre", "\\u", "save", "\\u", "receiver_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "save_", "._", "disconnect_", "(_", "post", "\\u", "save", "\\u", "receiver_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
alehander42/pseudo/pseudo/middlewares/__init__.py
[ { "content": "from pseudo.middlewares.declaration_middleware import DeclarationMiddleware\nfrom pseudo.middlewares.go_constructor_middleware import GoConstructorMiddleware\nfrom pseudo.middlewares.tuple_middleware import TupleMiddleware\nfrom pseudo.middlewares.name_middleware import NameMiddleware\nfrom pseudo.middlewares.cpp_pointer_middleware import CppPointerMiddleware\nfrom pseudo.middlewares.cpp_display_exception_middleware import CppDisplayExceptionMiddleware\nfrom pseudo.middlewares.aug_assignment_middleware import AugAssignmentMiddleware\nfrom pseudo.middlewares.standard_middleware import StandardMiddleware\n#\tgo_error_handling_middleware import GoErrorHandlingMiddleware\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from pseudo.middlewares.declaration_middleware import DeclarationMiddleware", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 75 }, { "span": "from pseudo.middlewares.go_constructor_middleware import GoConstructorMiddleware", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 80 }, { "span": "from pseudo.middlewares.tuple_middleware import TupleMiddleware", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 63 }, { "span": "from pseudo.middlewares.name_middleware import NameMiddleware", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 61 }, { "span": "from pseudo.middlewares.cpp_pointer_middleware import CppPointerMiddleware", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 74 }, { "span": "from pseudo.middlewares.cpp_display_exception_middleware import CppDisplayExceptionMiddleware", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 93 }, { "span": "from pseudo.middlewares.aug_assignment_middleware import AugAssignmentMiddleware", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 80 }, { "span": "from pseudo.middlewares.standard_middleware import StandardMiddleware", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 69 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "pseudo", "_", "._", "middle", "ware", "s_", "._", "declaration", "\\u", "middleware_", "import_", "Declarati", "on", "Middleware_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pseudo", "_", "._", "middle", "ware", "s_", "._", "go", "\\u", "construct", "or", "\\u", "middleware_", "import_", "Go", "Constructor", "Middleware_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pseudo", "_", "._", "middle", "ware", "s_", "._", "tuple", "\\u", "middleware_", "import_", "Tup", "le", "Middleware_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pseudo", "_", "._", "middle", "ware", "s_", "._", "name", "\\u", "middleware_", "import_", "Name", "Middleware_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pseudo", "_", "._", "middle", "ware", "s_", "._", "cpp", "\\u", "point", "er", "\\u", "middleware_", "import_", "Cp", "p", "Point", "er", "Middleware_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pseudo", "_", "._", "middle", "ware", "s_", "._", "cpp", "\\u", "display", "\\u", "exception", "\\u", "middleware_", "import_", "Cp", "p", "Display", "Except", "ion", "Middleware_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pseudo", "_", "._", "middle", "ware", "s_", "._", "aug", "\\u", "assign", "ment", "\\u", "middleware_", "import_", "Au", "g", "Assign", "ment", "Middleware_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pseudo", "_", "._", "middle", "ware", "s_", "._", "standard", "\\u", "middleware_", "import_", "Standard", "Middleware_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "\t", "go", "\\u", "error", "\\u", "handling", "\\u", "middle", "ware", " ", "import", " ", "Go", "Error", "Hand", "ling", "Middleware_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
kivy/python-for-android/pythonforandroid/recipes/hostpython3/__init__.py
[ { "content": "\nfrom pythonforandroid.toolchain import Recipe, shprint, current_directory, info, warning\nfrom os.path import join, exists\nfrom os import chdir\nimport sh\n\n\n\n\nrecipe = Hostpython3Recipe()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Hostpython3Recipe(Recipe):\n version = '3.5'\n # url = 'http://python.org/ftp/python/{version}/Python-{version}.tgz'\n url = 'https://github.com/crystax/android-vendor-python-3-5/archive/master.zip'\n name = 'hostpython3'\n\n conflicts = ['hostpython2']\n\n # def prebuild_armeabi(self):\n # # Override hostpython Setup?\n # shprint(sh.cp, join(self.get_recipe_dir(), 'Setup'),\n # join(self.get_build_dir('armeabi'), 'Modules', 'Setup'))\n", "metadata": "root.Hostpython3Recipe", "header": "['module', '___EOS___']", "index": 7 }, { "content": " def build_arch(self, arch):\n # AND: Should use an i386 recipe system\n warning('Running hostpython build. Arch is armeabi! '\n 'This is naughty, need to fix the Arch system!')\n\n # AND: Fix armeabi again\n with current_directory(self.get_build_dir(arch.arch)):\n\n if exists('hostpython'):\n info('hostpython already exists, skipping build')\n self.ctx.hostpython = join(self.get_build_dir('armeabi'),\n 'hostpython')\n self.ctx.hostpgen = join(self.get_build_dir('armeabi'),\n 'hostpgen')\n return\n \n configure = sh.Command('./configure')\n\n shprint(configure)\n shprint(sh.make, '-j5', 'BUILDPYTHON=hostpython', 'hostpython',\n 'PGEN=Parser/hostpgen', 'Parser/hostpgen')\n\n shprint(sh.mv, join('Parser', 'hostpgen'), 'hostpgen')\n\n # if exists('python.exe'):\n # shprint(sh.mv, 'python.exe', 'hostpython')\n # elif exists('python'):\n # shprint(sh.mv, 'python', 'hostpython')\n if exists('hostpython'):\n pass # The above commands should automatically create\n # the hostpython binary, unlike with python2\n else:\n warning('Unable to find the python executable after '\n 'hostpython build! Exiting.')\n exit(1)\n\n self.ctx.hostpython = join(self.get_build_dir(arch.arch), 'hostpython')\n self.ctx.hostpgen = join(self.get_build_dir(arch.arch), 'hostpgen')", "metadata": "root.Hostpython3Recipe.build_arch", "header": "['class', 'Hostpython3Recipe', '(', 'Recipe', ')', ':', '___EOS___']", "index": 20 } ]
[ { "span": "from os import chdir", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 20 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "python", "fora", "ndr", "oid_", "._", "toolchain_", "import_", "Recipe_", ",_", "shp", "rint_", ",_", "current", "\\u", "directory_", ",_", "info_", ",_", "warning_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "._", "path_", "import_", "join_", ",_", "exists_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "import_", "chdir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sh_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "recipe_", "=_", "Host", "python", "3", "Recipe_", "(_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Host", "python", "3", "Recipe_", "(_", "Recipe_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "version_", "=_", "'", "3.5", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "url", " ", "=", " ", "'", "http", "://", "python", ".", "org", "/", "ftp", "/", "python", "/{", "version", "}/", "Pyth", "on", "-", "{", "version", "}.", "tg", "z", "'_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "https", "://", "git", "hub", ".", "com", "/", "cry", "sta", "x", "/", "android", "-", "vendor", "-", "python", "-", "3", "-", "5", "/", "archive", "/", "master", ".", "zip", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "'", "hostp", "yth", "on", "3", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conflicts_", "=_", "[_", "'", "hostp", "yth", "on2", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "pre", "build", "\\u", "arme", "abi", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "Override", " ", "hostp", "yth", "on", " ", "Set", "up", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shp", "rint", "(", "sh", ".", "cp", ",", " ", "join", "(", "self", ".", "get", "\\u", "recip", "e\\u", "dir", "()", ",", " ", "'", "Set", "up", "')", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "join", "(", "self", ".", "get", "\\u", "build", "\\u", "dir", "('", "arme", "abi", "')", ",", " ", "'", "Modul", "es", "',", " ", "'", "Set", "up", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Host", "python", "3", "Recipe_", "(_", "Recipe_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "build", "\\u", "arch_", "(_", "self_", ",_", "arch_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "AND", ":", " ", "Sho", "ul", "d", " ", "use", " ", "an", " ", "i3", "86", " ", "recip", "e", " ", "system_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warning_", "(_", "'", "Run", "ning", " ", "hostp", "yth", "on", " ", "build", ".", " ", "Arch", " ", "is", " ", "arme", "abi", "!", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Thi", "s", " ", "is", " ", "na", "ugh", "ty", ",", " ", "need", " ", "to", " ", "fix", " ", "the", " ", "Arch", " ", "system", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AND", ":", " ", "Fix", " ", "arme", "abi", " ", "again", "_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "current", "\\u", "directory_", "(_", "self_", "._", "get", "\\u", "build", "\\u", "dir_", "(_", "arch_", "._", "arch_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "exists_", "(_", "'", "hostp", "yth", "on", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "(_", "'", "hostp", "yth", "on", " ", "alr", "ead", "y", " ", "exist", "s", ",", " ", "skip", "ping", " ", "build", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ctx_", "._", "hostp", "ython_", "=_", "join_", "(_", "self_", "._", "get", "\\u", "build", "\\u", "dir_", "(_", "'", "arme", "abi", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hostp", "yth", "on", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ctx_", "._", "hostp", "gen_", "=_", "join_", "(_", "self_", "._", "get", "\\u", "build", "\\u", "dir_", "(_", "'", "arme", "abi", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hostp", "gen", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "configure_", "=_", "sh_", "._", "Command_", "(_", "'./", "configur", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "shp", "rint_", "(_", "configure_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shp", "rint_", "(_", "sh_", "._", "make_", ",_", "'-", "j", "5", "'_", ",_", "'", "BUILD", "PYTHON", "=", "hostp", "yth", "on", "'_", ",_", "'", "hostp", "yth", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PG", "EN", "=", "Parser", "/", "hostp", "gen", "'_", ",_", "'", "Parser", "/", "hostp", "gen", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "shp", "rint_", "(_", "sh_", "._", "mv_", ",_", "join_", "(_", "'", "Parser", "'_", ",_", "'", "hostp", "gen", "'_", ")_", ",_", "'", "hostp", "gen", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "exist", "s", "('", "python", ".", "exe", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shp", "rint", "(", "sh", ".", "mv", ",", " ", "'", "python", ".", "exe", "',", " ", "'", "hostp", "yth", "on", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "eli", "f", " ", "exist", "s", "('", "python", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shp", "rint", "(", "sh", ".", "mv", ",", " ", "'", "python", "',", " ", "'", "hostp", "yth", "on", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "exists_", "(_", "'", "hostp", "yth", "on", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "#", " ", "The", " ", "above", " ", "command", "s", " ", "shou", "ld", " ", "automati", "call", "y", " ", "create_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "hostp", "yth", "on", " ", "binar", "y", ",", " ", "unli", "ke", " ", "with", " ", "python", "2_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warning_", "(_", "'", "Una", "ble", " ", "to", " ", "find", " ", "the", " ", "python", " ", "executable", " ", "after", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hostp", "yth", "on", " ", "build", "!", " ", "Exi", "ting", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "ctx_", "._", "hostp", "ython_", "=_", "join_", "(_", "self_", "._", "get", "\\u", "build", "\\u", "dir_", "(_", "arch_", "._", "arch_", ")_", ",_", "'", "hostp", "yth", "on", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ctx_", "._", "hostp", "gen_", "=_", "join_", "(_", "self_", "._", "get", "\\u", "build", "\\u", "dir_", "(_", "arch_", "._", "arch_", ")_", ",_", "'", "hostp", "gen", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
mbedmicro/pyOCD/test/flash_test.py
[ { "content": "def flash_test(board_id):\n with MbedBoard.chooseBoard(board_id=board_id, frequency=1000000) as board:\n target_type = board.getTargetType()\n\n test_clock = 10000000\n if target_type == \"nrf51\":\n # Override clock since 10MHz is too fast\n test_clock = 1000000\n\n memory_map = board.target.getMemoryMap()\n ram_regions = [region for region in memory_map if region.type == 'ram']\n ram_region = ram_regions[0]\n rom_region = memory_map.getBootMemory()\n\n ram_start = ram_region.start\n ram_size = ram_region.length\n rom_start = rom_region.start\n rom_size = rom_region.length\n\n target = board.target\n link = board.link\n flash = board.flash\n\n link.set_clock(test_clock)\n link.set_deferred_transfer(True)\n\n test_pass_count = 0\n test_count = 0\n result = FlashTestResult()\n\n def print_progress(progress):\n assert progress >= 0.0\n assert progress <= 1.0\n assert (progress == 0 and print_progress.prev_progress == 1.0) or (progress >= print_progress.prev_progress)\n\n # Reset state on 0.0\n if progress == 0.0:\n print_progress.prev_progress = 0\n print_progress.backwards_progress = False\n print_progress.done = False\n\n # Check for backwards progress\n if progress < print_progress.prev_progress:\n print_progress.backwards_progress = True\n print_progress.prev_progress = progress\n\n # print progress bar\n if not print_progress.done:\n sys.stdout.write('\\r')\n i = int(progress * 20.0)\n sys.stdout.write(\"[%-20s] %3d%%\" % ('=' * i, round(progress * 100)))\n sys.stdout.flush()\n\n # Finish on 1.0\n if progress >= 1.0:\n if not print_progress.done:\n print_progress.done = True\n sys.stdout.write(\"\\n\")\n if print_progress.backwards_progress:\n print(\"Progress went backwards during flash\")\n print_progress.prev_progress = 0\n\n binary_file = os.path.join(parentdir, 'binaries', board.getTestBinary())\n with open(binary_file, \"rb\") as f:\n data = f.read()\n data = struct.unpack(\"%iB\" % len(data), data)\n unused = rom_size - len(data)\n\n addr = rom_start\n size = len(data)\n\n # Turn on extra checks for the next 4 tests\n flash.setFlashAlgoDebug(True)\n\n print(\"\\r\\n\\r\\n------ Test Basic Page Erase ------\")\n info = flash.flashBlock(addr, data, False, False, progress_cb=print_progress)\n data_flashed = target.readBlockMemoryUnaligned8(addr, size)\n if same(data_flashed, data) and info.program_type is FlashBuilder.FLASH_PAGE_ERASE:\n print(\"TEST PASSED\")\n test_pass_count += 1\n else:\n print(\"TEST FAILED\")\n test_count += 1\n\n print(\"\\r\\n\\r\\n------ Test Basic Chip Erase ------\")\n info = flash.flashBlock(addr, data, False, True, progress_cb=print_progress)\n data_flashed = target.readBlockMemoryUnaligned8(addr, size)\n if same(data_flashed, data) and info.program_type is FlashBuilder.FLASH_CHIP_ERASE:\n print(\"TEST PASSED\")\n test_pass_count += 1\n else:\n print(\"TEST FAILED\")\n test_count += 1\n\n print(\"\\r\\n\\r\\n------ Test Smart Page Erase ------\")\n info = flash.flashBlock(addr, data, True, False, progress_cb=print_progress)\n data_flashed = target.readBlockMemoryUnaligned8(addr, size)\n if same(data_flashed, data) and info.program_type is FlashBuilder.FLASH_PAGE_ERASE:\n print(\"TEST PASSED\")\n test_pass_count += 1\n else:\n print(\"TEST FAILED\")\n test_count += 1\n\n print(\"\\r\\n\\r\\n------ Test Smart Chip Erase ------\")\n info = flash.flashBlock(addr, data, True, True, progress_cb=print_progress)\n data_flashed = target.readBlockMemoryUnaligned8(addr, size)\n if same(data_flashed, data) and info.program_type is FlashBuilder.FLASH_CHIP_ERASE:\n print(\"TEST PASSED\")\n test_pass_count += 1\n else:\n print(\"TEST FAILED\")\n test_count += 1\n\n flash.setFlashAlgoDebug(False)\n\n print(\"\\r\\n\\r\\n------ Test Basic Page Erase (Entire chip) ------\")\n new_data = list(data)\n new_data.extend(unused * [0x77])\n info = flash.flashBlock(0, new_data, False, False, progress_cb=print_progress)\n if info.program_type == FlashBuilder.FLASH_PAGE_ERASE:\n print(\"TEST PASSED\")\n test_pass_count += 1\n result.page_erase_rate = float(len(new_data)) / float(info.program_time)\n else:\n print(\"TEST FAILED\")\n test_count += 1\n\n print(\"\\r\\n\\r\\n------ Test Fast Verify ------\")\n info = flash.flashBlock(0, new_data, progress_cb=print_progress, fast_verify=True)\n if info.program_type == FlashBuilder.FLASH_PAGE_ERASE:\n print(\"TEST PASSED\")\n test_pass_count += 1\n else:\n print(\"TEST FAILED\")\n test_count += 1\n\n print(\"\\r\\n\\r\\n------ Test Offset Write ------\")\n addr = rom_start + rom_size / 2\n page_size = flash.getPageInfo(addr).size\n new_data = [0x55] * page_size * 2\n info = flash.flashBlock(addr, new_data, progress_cb=print_progress)\n data_flashed = target.readBlockMemoryUnaligned8(addr, len(new_data))\n if same(data_flashed, new_data) and info.program_type is FlashBuilder.FLASH_PAGE_ERASE:\n print(\"TEST PASSED\")\n test_pass_count += 1\n else:\n print(\"TEST FAILED\")\n test_count += 1\n\n print(\"\\r\\n\\r\\n------ Test Multiple Block Writes ------\")\n addr = rom_start + rom_size / 2\n page_size = flash.getPageInfo(addr).size\n more_data = [0x33] * page_size * 2\n addr = (rom_start + rom_size / 2) + 1 #cover multiple pages\n fb = flash.getFlashBuilder()\n fb.addData(rom_start, data)\n fb.addData(addr, more_data)\n fb.program(progress_cb=print_progress)\n data_flashed = target.readBlockMemoryUnaligned8(rom_start, len(data))\n data_flashed_more = target.readBlockMemoryUnaligned8(addr, len(more_data))\n if same(data_flashed, data) and same(data_flashed_more, more_data):\n print(\"TEST PASSED\")\n test_pass_count += 1\n else:\n print(\"TEST FAILED\")\n test_count += 1\n\n print(\"\\r\\n\\r\\n------ Test Overlapping Blocks ------\")\n test_pass = False\n addr = (rom_start + rom_size / 2) #cover multiple pages\n page_size = flash.getPageInfo(addr).size\n new_data = [0x33] * page_size\n fb = flash.getFlashBuilder()\n fb.addData(addr, new_data)\n try:\n fb.addData(addr + 1, new_data)\n except ValueError as e:\n print(\"Exception: %s\" % e)\n test_pass = True\n if test_pass:\n print(\"TEST PASSED\")\n test_pass_count += 1\n else:\n print(\"TEST FAILED\")\n test_count += 1\n\n print(\"\\r\\n\\r\\n------ Test Empty Block Write ------\")\n # Freebee if nothing asserts\n fb = flash.getFlashBuilder()\n fb.program()\n print(\"TEST PASSED\")\n test_pass_count += 1\n test_count += 1\n\n print(\"\\r\\n\\r\\n------ Test Missing Progress Callback ------\")\n # Freebee if nothing asserts\n addr = rom_start\n flash.flashBlock(rom_start, data, True)\n print(\"TEST PASSED\")\n test_pass_count += 1\n test_count += 1\n\n # Only run test if the reset handler can be programmed (rom start at address 0)\n if rom_start == 0:\n print(\"\\r\\n\\r\\n------ Test Non-Thumb reset handler ------\")\n non_thumb_data = list(data)\n # Clear bit 0 of 2nd word - reset handler\n non_thumb_data[4] = non_thumb_data[4] & ~1\n flash.flashBlock(rom_start, non_thumb_data)\n flash.flashBlock(rom_start, data)\n print(\"TEST PASSED\")\n test_pass_count += 1\n test_count += 1\n\n # Note - The decision based tests below are order dependent since they\n # depend on the previous state of the flash\n\n print(\"\\r\\n\\r\\n------ Test Chip Erase Decision ------\")\n new_data = list(data)\n new_data.extend([0xff] * unused) # Pad with 0xFF\n info = flash.flashBlock(0, new_data, progress_cb=print_progress)\n if info.program_type == FlashBuilder.FLASH_CHIP_ERASE:\n print(\"TEST PASSED\")\n test_pass_count += 1\n result.chip_erase_rate_erased = float(len(new_data)) / float(info.program_time)\n else:\n print(\"TEST FAILED\")\n test_count += 1\n\n print(\"\\r\\n\\r\\n------ Test Chip Erase Decision 2 ------\")\n new_data = list(data)\n new_data.extend([0x00] * unused) # Pad with 0x00\n info = flash.flashBlock(0, new_data, progress_cb=print_progress)\n if info.program_type == FlashBuilder.FLASH_CHIP_ERASE:\n print(\"TEST PASSED\")\n test_pass_count += 1\n result.chip_erase_rate = float(len(new_data)) / float(info.program_time)\n else:\n print(\"TEST FAILED\")\n test_count += 1\n\n print(\"\\r\\n\\r\\n------ Test Page Erase Decision ------\")\n new_data = list(data)\n new_data.extend([0x00] * unused) # Pad with 0x00\n info = flash.flashBlock(0, new_data, progress_cb=print_progress)\n if info.program_type == FlashBuilder.FLASH_PAGE_ERASE:\n print(\"TEST PASSED\")\n test_pass_count += 1\n result.page_erase_rate_same = float(len(new_data)) / float(info.program_time)\n result.analyze = info.analyze_type\n result.analyze_time = info.analyze_time\n result.analyze_rate = float(len(new_data)) / float(info.analyze_time)\n else:\n print(\"TEST FAILED\")\n test_count += 1\n\n print(\"\\r\\n\\r\\n------ Test Page Erase Decision 2 ------\")\n new_data = list(data)\n size_same = unused * 5 / 6\n size_differ = unused - size_same\n new_data.extend([0x00] * size_same) # Pad 5/6 with 0x00 and 1/6 with 0xFF\n new_data.extend([0x55] * size_differ)\n info = flash.flashBlock(0, new_data, progress_cb=print_progress)\n if info.program_type == FlashBuilder.FLASH_PAGE_ERASE:\n print(\"TEST PASSED\")\n test_pass_count += 1\n else:\n print(\"TEST FAILED\")\n test_count += 1\n\n print(\"\\r\\n\\r\\nTest Summary:\")\n print(\"Pass count %i of %i tests\" % (test_pass_count, test_count))\n if test_pass_count == test_count:\n print(\"FLASH TEST SCRIPT PASSED\")\n else:\n print(\"FLASH TEST SCRIPT FAILED\")\n\n target.reset()\n\n result.passed = test_count == test_pass_count\n return result", "metadata": "root.flash_test", "header": "['module', '___EOS___']", "index": 121 } ]
[ { "span": "ram_start ", "start_line": 135, "start_column": 8, "end_line": 135, "end_column": 17 }, { "span": "ram_size ", "start_line": 136, "start_column": 8, "end_line": 136, "end_column": 16 }, { "span": "addr ", "start_line": 318, "start_column": 8, "end_line": 318, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "flash", "\\u", "test_", "(_", "board", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "Mb", "ed", "Board_", "._", "choose", "Board_", "(_", "board", "\\u", "id_", "=_", "board", "\\u", "id_", ",_", "frequency_", "=_", "1000000_", ")_", "as_", "board_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "\\u", "type_", "=_", "board_", "._", "get", "Target", "Type_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "clock_", "=_", "10000000", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "target", "\\u", "type_", "==_", "\"", "nr", "f5", "1", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Override", " ", "clock", " ", "sinc", "e", " ", "10", "MH", "z", " ", "is", " ", "too", " ", "fast_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "clock_", "=_", "1000000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "memory", "\\u", "map_", "=_", "board_", "._", "target_", "._", "get", "Memo", "ry", "Map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ram", "\\u", "regions_", "=_", "[_", "region_", "for_", "region_", "in_", "memory", "\\u", "map_", "if_", "region_", "._", "type_", "==_", "'", "ram", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ram", "\\u", "region_", "=_", "ram", "\\u", "regions_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rom", "\\u", "region_", "=_", "memory", "\\u", "map_", "._", "get", "Boot", "Memory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ram", "\\u", "start_", "=_", "ram", "\\u", "region_", "._", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ram", "\\u", "size_", "=_", "ram", "\\u", "region_", "._", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rom", "\\u", "start_", "=_", "rom", "\\u", "region_", "._", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rom", "\\u", "size_", "=_", "rom", "\\u", "region_", "._", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "target_", "=_", "board_", "._", "target_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link_", "=_", "board_", "._", "link_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flash_", "=_", "board_", "._", "flash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "link_", "._", "set\\u", "clock_", "(_", "test\\u", "clock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link_", "._", "set\\u", "defer", "red", "\\u", "transfer_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "pass", "\\u", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "Fla", "sh", "Test", "Result_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "print", "\\u", "progress_", "(_", "progress_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "progress_", ">=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "progress_", "<=_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "progress_", "==_", "0_", "and_", "print", "\\u", "progress_", "._", "prev", "\\u", "progress_", "==_", "1.0_", ")_", "or_", "(_", "progress_", ">=_", "print", "\\u", "progress_", "._", "prev", "\\u", "progress_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Reset", " ", "state", " ", "on", " ", "0.0_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "progress_", "==_", "0.0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "progress_", "._", "prev", "\\u", "progress_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "progress_", "._", "back", "ward", "s", "\\u", "progress_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "progress_", "._", "done_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "for", " ", "back", "ward", "s", " ", "progress_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "progress_", "<_", "print", "\\u", "progress_", "._", "prev", "\\u", "progress_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "progress_", "._", "back", "ward", "s", "\\u", "progress_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print", "\\u", "progress_", "._", "prev", "\\u", "progress_", "=_", "progress_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "progress", " ", "bar_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "print", "\\u", "progress_", "._", "done_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stdout_", "._", "write_", "(_", "'\\\\", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "int_", "(_", "progress_", "*_", "20.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "\"[", "%", "-", "20", "s", "]", " ", "%", "3d", "%%\"_", "%_", "(_", "'='_", "*_", "i_", ",_", "round_", "(_", "progress_", "*_", "100_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Finish", " ", "on", " ", "1.0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "progress_", ">=_", "1.0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "print", "\\u", "progress_", "._", "done_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print", "\\u", "progress_", "._", "done_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "print", "\\u", "progress_", "._", "back", "ward", "s", "\\u", "progress_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "(_", "\"", "Progres", "s", " ", "wen", "t", " ", "back", "ward", "s", " ", "dur", "ing", " ", "flash", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print", "\\u", "progress_", "._", "prev", "\\u", "progress_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "binar", "y", "\\u", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "parent", "dir_", ",_", "'", "binaries", "'_", ",_", "board_", "._", "get", "Test", "Binary_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "binar", "y", "\\u", "file_", ",_", "\"", "rb", "\"_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "struct_", "._", "unpack_", "(_", "\"%", "i", "B", "\"_", "%_", "len_", "(_", "data_", ")_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unused_", "=_", "rom", "\\u", "size_", "-_", "len_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "addr_", "=_", "rom", "\\u", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "len_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Turn", " ", "on", " ", "extra", " ", "checks", " ", "for", " ", "the", " ", "next", " ", "4", " ", "tests_", "\\u\\u\\uNL\\u\\u\\u_", "flash_", "._", "set", "Fla", "sh", "Algo", "Debug_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "------", " ", "Test", " ", "Basic", " ", "Page", " ", "Erase", " ", "------", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "flash_", "._", "flash", "Block_", "(_", "addr_", ",_", "data_", ",_", "False_", ",_", "False_", ",_", "progress", "\\u", "cb_", "=_", "print", "\\u", "progress_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "flash", "ed_", "=_", "target_", "._", "read", "Block", "Memo", "ry", "Una", "ligne", "d8", "_", "(_", "addr_", ",_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "same_", "(_", "data\\u", "flash", "ed_", ",_", "data_", ")_", "and_", "info_", "._", "program", "\\u", "type_", "is_", "Fla", "sh", "Builder_", "._", "FLASH", "\\u", "PAGE", "\\u", "ERA", "SE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "TEST", " ", "PASSED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "pass", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "TEST", " ", "FAIL", "ED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "------", " ", "Test", " ", "Basic", " ", "Chip", " ", "Erase", " ", "------", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "flash_", "._", "flash", "Block_", "(_", "addr_", ",_", "data_", ",_", "False_", ",_", "True_", ",_", "progress", "\\u", "cb_", "=_", "print", "\\u", "progress_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "flash", "ed_", "=_", "target_", "._", "read", "Block", "Memo", "ry", "Una", "ligne", "d8", "_", "(_", "addr_", ",_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "same_", "(_", "data\\u", "flash", "ed_", ",_", "data_", ")_", "and_", "info_", "._", "program", "\\u", "type_", "is_", "Fla", "sh", "Builder_", "._", "FLASH", "\\u", "CHI", "P", "\\u", "ERA", "SE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "TEST", " ", "PASSED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "pass", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "TEST", " ", "FAIL", "ED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "------", " ", "Test", " ", "Sma", "rt", " ", "Page", " ", "Erase", " ", "------", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "flash_", "._", "flash", "Block_", "(_", "addr_", ",_", "data_", ",_", "True_", ",_", "False_", ",_", "progress", "\\u", "cb_", "=_", "print", "\\u", "progress_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "flash", "ed_", "=_", "target_", "._", "read", "Block", "Memo", "ry", "Una", "ligne", "d8", "_", "(_", "addr_", ",_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "same_", "(_", "data\\u", "flash", "ed_", ",_", "data_", ")_", "and_", "info_", "._", "program", "\\u", "type_", "is_", "Fla", "sh", "Builder_", "._", "FLASH", "\\u", "PAGE", "\\u", "ERA", "SE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "TEST", " ", "PASSED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "pass", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "TEST", " ", "FAIL", "ED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "------", " ", "Test", " ", "Sma", "rt", " ", "Chip", " ", "Erase", " ", "------", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "flash_", "._", "flash", "Block_", "(_", "addr_", ",_", "data_", ",_", "True_", ",_", "True_", ",_", "progress", "\\u", "cb_", "=_", "print", "\\u", "progress_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "flash", "ed_", "=_", "target_", "._", "read", "Block", "Memo", "ry", "Una", "ligne", "d8", "_", "(_", "addr_", ",_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "same_", "(_", "data\\u", "flash", "ed_", ",_", "data_", ")_", "and_", "info_", "._", "program", "\\u", "type_", "is_", "Fla", "sh", "Builder_", "._", "FLASH", "\\u", "CHI", "P", "\\u", "ERA", "SE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "TEST", " ", "PASSED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "pass", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "TEST", " ", "FAIL", "ED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "flash_", "._", "set", "Fla", "sh", "Algo", "Debug_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "------", " ", "Test", " ", "Basic", " ", "Page", " ", "Erase", " ", "(", "Ent", "ire", " ", "chi", "p", ")", " ", "------", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "data_", "=_", "list_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "data_", "._", "extend_", "(_", "unused_", "*_", "[_", "0x7", "7_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "flash_", "._", "flash", "Block_", "(_", "0_", ",_", "new", "\\u", "data_", ",_", "False_", ",_", "False_", ",_", "progress", "\\u", "cb_", "=_", "print", "\\u", "progress_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "info_", "._", "program", "\\u", "type_", "==_", "Fla", "sh", "Builder_", "._", "FLASH", "\\u", "PAGE", "\\u", "ERA", "SE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "TEST", " ", "PASSED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "pass", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "page", "\\u", "erase", "\\u", "rate_", "=_", "float_", "(_", "len_", "(_", "new", "\\u", "data_", ")_", ")_", "/_", "float_", "(_", "info_", "._", "program", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "TEST", " ", "FAIL", "ED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "------", " ", "Test", " ", "Fast", " ", "Verify", " ", "------", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "flash_", "._", "flash", "Block_", "(_", "0_", ",_", "new", "\\u", "data_", ",_", "progress", "\\u", "cb_", "=_", "print", "\\u", "progress_", ",_", "fast", "\\u", "verify_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "info_", "._", "program", "\\u", "type_", "==_", "Fla", "sh", "Builder_", "._", "FLASH", "\\u", "PAGE", "\\u", "ERA", "SE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "TEST", " ", "PASSED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "pass", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "TEST", " ", "FAIL", "ED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "------", " ", "Test", " ", "Off", "set", " ", "Write", " ", "------", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addr_", "=_", "rom", "\\u", "start_", "+_", "rom", "\\u", "size_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "\\u", "size_", "=_", "flash_", "._", "get", "Page", "Info_", "(_", "addr_", ")_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "data_", "=_", "[_", "0x55", "_", "]_", "*_", "page", "\\u", "size_", "*_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "flash_", "._", "flash", "Block_", "(_", "addr_", ",_", "new", "\\u", "data_", ",_", "progress", "\\u", "cb_", "=_", "print", "\\u", "progress_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "flash", "ed_", "=_", "target_", "._", "read", "Block", "Memo", "ry", "Una", "ligne", "d8", "_", "(_", "addr_", ",_", "len_", "(_", "new", "\\u", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "same_", "(_", "data\\u", "flash", "ed_", ",_", "new", "\\u", "data_", ")_", "and_", "info_", "._", "program", "\\u", "type_", "is_", "Fla", "sh", "Builder_", "._", "FLASH", "\\u", "PAGE", "\\u", "ERA", "SE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "TEST", " ", "PASSED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "pass", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "TEST", " ", "FAIL", "ED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "------", " ", "Test", " ", "Multipl", "e", " ", "Block", " ", "Write", "s", " ", "------", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addr_", "=_", "rom", "\\u", "start_", "+_", "rom", "\\u", "size_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "\\u", "size_", "=_", "flash_", "._", "get", "Page", "Info_", "(_", "addr_", ")_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "more", "\\u", "data_", "=_", "[_", "0x33", "_", "]_", "*_", "page", "\\u", "size_", "*_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addr_", "=_", "(_", "rom", "\\u", "start_", "+_", "rom", "\\u", "size_", "/_", "2_", ")_", "+_", "1_", "#", "cover", " ", "multiple", " ", "pages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fb_", "=_", "flash_", "._", "get", "Fla", "sh", "Builder_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fb_", "._", "add", "Data_", "(_", "rom", "\\u", "start_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fb_", "._", "add", "Data_", "(_", "addr_", ",_", "more", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fb_", "._", "program_", "(_", "progress", "\\u", "cb_", "=_", "print", "\\u", "progress_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "flash", "ed_", "=_", "target_", "._", "read", "Block", "Memo", "ry", "Una", "ligne", "d8", "_", "(_", "rom", "\\u", "start_", ",_", "len_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "flash", "ed", "\\u", "more_", "=_", "target_", "._", "read", "Block", "Memo", "ry", "Una", "ligne", "d8", "_", "(_", "addr_", ",_", "len_", "(_", "more", "\\u", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "same_", "(_", "data\\u", "flash", "ed_", ",_", "data_", ")_", "and_", "same_", "(_", "data\\u", "flash", "ed", "\\u", "more_", ",_", "more", "\\u", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "TEST", " ", "PASSED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "pass", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "TEST", " ", "FAIL", "ED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "------", " ", "Test", " ", "Overlap", "ping", " ", "Block", "s", " ", "------", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "pass_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addr_", "=_", "(_", "rom", "\\u", "start_", "+_", "rom", "\\u", "size_", "/_", "2_", ")_", "#", "cover", " ", "multiple", " ", "pages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "\\u", "size_", "=_", "flash_", "._", "get", "Page", "Info_", "(_", "addr_", ")_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "data_", "=_", "[_", "0x33", "_", "]_", "*_", "page", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fb_", "=_", "flash_", "._", "get", "Fla", "sh", "Builder_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fb_", "._", "add", "Data_", "(_", "addr_", ",_", "new", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fb_", "._", "add", "Data_", "(_", "addr_", "+_", "1_", ",_", "new", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Except", "ion", ":", " ", "%", "s", "\"_", "%_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "pass_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "test\\u", "pass_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "TEST", " ", "PASSED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "pass", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "TEST", " ", "FAIL", "ED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "------", " ", "Test", " ", "Emp", "ty", " ", "Block", " ", "Write", " ", "------", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Free", "bee", " ", "if", " ", "not", "hing", " ", "asserts", "_", "\\u\\u\\uNL\\u\\u\\u_", "fb_", "=_", "flash_", "._", "get", "Fla", "sh", "Builder_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fb_", "._", "program_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "TEST", " ", "PASSED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "pass", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "------", " ", "Test", " ", "Missing", " ", "Progres", "s", " ", "Call", "back", " ", "------", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Free", "bee", " ", "if", " ", "not", "hing", " ", "asserts", "_", "\\u\\u\\uNL\\u\\u\\u_", "addr_", "=_", "rom", "\\u", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flash_", "._", "flash", "Block_", "(_", "rom", "\\u", "start_", ",_", "data_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "TEST", " ", "PASSED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "pass", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ly", " ", "run", " ", "test", " ", "if", " ", "the", " ", "reset", " ", "handler", " ", "can", " ", "be", " ", "programme", "d", " ", "(", "rom", " ", "start", " ", "at", " ", "address", " ", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "rom", "\\u", "start_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "------", " ", "Test", " ", "Non", "-", "Thumb", " ", "reset", " ", "handler", " ", "------", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "non", "\\u", "thumb", "\\u", "data_", "=_", "list_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Clear", " ", "bit", " ", "0", " ", "of", " ", "2n", "d", " ", "word", " ", "-", " ", "reset", " ", "handler_", "\\u\\u\\uNL\\u\\u\\u_", "non", "\\u", "thumb", "\\u", "data_", "[_", "4_", "]_", "=_", "non", "\\u", "thumb", "\\u", "data_", "[_", "4_", "]_", "&_", "~_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flash_", "._", "flash", "Block_", "(_", "rom", "\\u", "start_", ",_", "non", "\\u", "thumb", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flash_", "._", "flash", "Block_", "(_", "rom", "\\u", "start_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "TEST", " ", "PASSED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "pass", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "-", " ", "The", " ", "decision", " ", "based", " ", "tests", " ", "belo", "w", " ", "are", " ", "order", " ", "dependent", " ", "sinc", "e", " ", "the", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "depend", " ", "on", " ", "the", " ", "previ", "ous", " ", "state", " ", "of", " ", "the", " ", "flash_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "------", " ", "Test", " ", "Chip", " ", "Erase", " ", "Deci", "sion", " ", "------", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "data_", "=_", "list_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "data_", "._", "extend_", "(_", "[_", "0xff_", "]_", "*_", "unused_", ")_", "#", " ", "Pad", " ", "with", " ", "0xFF_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "flash_", "._", "flash", "Block_", "(_", "0_", ",_", "new", "\\u", "data_", ",_", "progress", "\\u", "cb_", "=_", "print", "\\u", "progress_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "info_", "._", "program", "\\u", "type_", "==_", "Fla", "sh", "Builder_", "._", "FLASH", "\\u", "CHI", "P", "\\u", "ERA", "SE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "TEST", " ", "PASSED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "pass", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "chi", "p", "\\u", "erase", "\\u", "rate", "\\u", "erase", "d_", "=_", "float_", "(_", "len_", "(_", "new", "\\u", "data_", ")_", ")_", "/_", "float_", "(_", "info_", "._", "program", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "TEST", " ", "FAIL", "ED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "------", " ", "Test", " ", "Chip", " ", "Erase", " ", "Deci", "sion", " ", "2", " ", "------", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "data_", "=_", "list_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "data_", "._", "extend_", "(_", "[_", "0x00_", "]_", "*_", "unused_", ")_", "#", " ", "Pad", " ", "with", " ", "0x00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "flash_", "._", "flash", "Block_", "(_", "0_", ",_", "new", "\\u", "data_", ",_", "progress", "\\u", "cb_", "=_", "print", "\\u", "progress_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "info_", "._", "program", "\\u", "type_", "==_", "Fla", "sh", "Builder_", "._", "FLASH", "\\u", "CHI", "P", "\\u", "ERA", "SE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "TEST", " ", "PASSED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "pass", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "chi", "p", "\\u", "erase", "\\u", "rate_", "=_", "float_", "(_", "len_", "(_", "new", "\\u", "data_", ")_", ")_", "/_", "float_", "(_", "info_", "._", "program", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "TEST", " ", "FAIL", "ED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "------", " ", "Test", " ", "Page", " ", "Erase", " ", "Deci", "sion", " ", "------", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "data_", "=_", "list_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "data_", "._", "extend_", "(_", "[_", "0x00_", "]_", "*_", "unused_", ")_", "#", " ", "Pad", " ", "with", " ", "0x00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "flash_", "._", "flash", "Block_", "(_", "0_", ",_", "new", "\\u", "data_", ",_", "progress", "\\u", "cb_", "=_", "print", "\\u", "progress_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "info_", "._", "program", "\\u", "type_", "==_", "Fla", "sh", "Builder_", "._", "FLASH", "\\u", "PAGE", "\\u", "ERA", "SE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "TEST", " ", "PASSED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "pass", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "page", "\\u", "erase", "\\u", "rate", "\\u", "same_", "=_", "float_", "(_", "len_", "(_", "new", "\\u", "data_", ")_", ")_", "/_", "float_", "(_", "info_", "._", "program", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "analyze_", "=_", "info_", "._", "analyze", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "analyze", "\\u", "time_", "=_", "info_", "._", "analyze", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "analyze", "\\u", "rate_", "=_", "float_", "(_", "len_", "(_", "new", "\\u", "data_", ")_", ")_", "/_", "float_", "(_", "info_", "._", "analyze", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "TEST", " ", "FAIL", "ED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "------", " ", "Test", " ", "Page", " ", "Erase", " ", "Deci", "sion", " ", "2", " ", "------", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "data_", "=_", "list_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size", "\\u", "same_", "=_", "unused_", "*_", "5_", "/_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size", "\\u", "differ", "_", "=_", "unused_", "-_", "size", "\\u", "same_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "data_", "._", "extend_", "(_", "[_", "0x00_", "]_", "*_", "size", "\\u", "same_", ")_", "#", " ", "Pad", " ", "5", "/", "6", " ", "with", " ", "0x00", " ", "and", " ", "1", "/", "6", " ", "with", " ", "0xFF_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "data_", "._", "extend_", "(_", "[_", "0x55", "_", "]_", "*_", "size", "\\u", "differ", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "flash_", "._", "flash", "Block_", "(_", "0_", ",_", "new", "\\u", "data_", ",_", "progress", "\\u", "cb_", "=_", "print", "\\u", "progress_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "info_", "._", "program", "\\u", "type_", "==_", "Fla", "sh", "Builder_", "._", "FLASH", "\\u", "PAGE", "\\u", "ERA", "SE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "TEST", " ", "PASSED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "pass", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "TEST", " ", "FAIL", "ED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "Test", " ", "Summ", "ary", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Pass", " ", "count", " ", "%", "i", " ", "of", " ", "%", "i", " ", "tests", "\"_", "%_", "(_", "test\\u", "pass", "\\u", "count_", ",_", "test\\u", "count_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "test\\u", "pass", "\\u", "count_", "==_", "test\\u", "count_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "FLASH", " ", "TEST", " ", "SCRIPT", " ", "PASSED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "FLASH", " ", "TEST", " ", "SCRIPT", " ", "FAIL", "ED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "target_", "._", "reset_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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
plivo/sharq/sharq/queue.py
[ { "content": "# -*- coding: utf-8 -*-\n# Copyright (c) 2014 Plivo Team. See LICENSE.txt for details.\nimport os\nimport sys\nimport signal\nimport ConfigParser\nimport redis\nfrom sharq.utils import (is_valid_identifier, is_valid_interval,\n is_valid_requeue_limit, generate_epoch,\n serialize_payload, deserialize_payload)\nfrom sharq.exceptions import SharqException, BadArgumentException\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class SharQ(object):\n \"\"\"The SharQ object is the core of this queue.\n SharQ does the following.\n\n 1. Accepts a configuration file.\n 2. Initializes the queue.\n 3. Exposes functions to interact with the queue.\n \"\"\"\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.SharQ", "header": "['module', '___EOS___']", "index": 13 }, { "content": " def __init__(self, config_path):\n \"\"\"Construct a SharQ object by doing the following.\n 1. Read the configuration path.\n 2. Load the config.\n 3. Initialized SharQ.\n \"\"\"\n self.config_path = config_path\n self._load_config()\n self._initialize()", "metadata": "root.SharQ.__init__", "header": "['class', 'SharQ', '(', 'object', ')', ':', '___EOS___']", "index": 22 }, { "content": " def _initialize(self):\n \"\"\"Read the SharQ configuration and set appropriate\n variables. Open a redis connection pool and load all\n the Lua scripts.\n \"\"\"\n self._key_prefix = self._config.get('redis', 'key_prefix')\n self._job_expire_interval = int(\n self._config.get('sharq', 'job_expire_interval')\n )\n self._default_job_requeue_limit = int(\n self._config.get('sharq', 'default_job_requeue_limit')\n )\n\n # initalize redis\n redis_connection_type = self._config.get('redis', 'conn_type')\n db = self._config.get('redis', 'db')\n if redis_connection_type == 'unix_sock':\n self._r = redis.StrictRedis(\n db=db,\n unix_socket_path=self._config.get('redis', 'unix_socket_path')\n )\n elif redis_connection_type == 'tcp_sock':\n self._r = redis.StrictRedis(\n db=db,\n host=self._config.get('redis', 'host'),\n port=self._config.get('redis', 'port')\n )\n\n self._load_lua_scripts()", "metadata": "root.SharQ._initialize", "header": "['class', 'SharQ', '(', 'object', ')', ':', '___EOS___']", "index": 32 }, { "content": " def _load_config(self):\n \"\"\"Read the configuration file and load it into memory.\"\"\"\n self._config = ConfigParser.SafeConfigParser()\n self._config.read(self.config_path)", "metadata": "root.SharQ._load_config", "header": "['class', 'SharQ', '(', 'object', ')', ':', '___EOS___']", "index": 62 }, { "content": " def reload_config(self, config_path=None):\n \"\"\"Reload the configuration from the new config file if provided\n else reload the current config file.\n \"\"\"\n if config_path:\n self.config_path = config_path\n self._load_config()", "metadata": "root.SharQ.reload_config", "header": "['class', 'SharQ', '(', 'object', ')', ':', '___EOS___']", "index": 67 }, { "content": " def _load_lua_scripts(self):\n \"\"\"Loads all lua scripts required by SharQ.\"\"\"\n # load lua scripts\n lua_script_path = os.path.join(\n os.path.dirname(os.path.abspath(__file__)),\n 'scripts/lua'\n )\n with open(os.path.join(\n lua_script_path,\n 'enqueue.lua'), 'r') as enqueue_file:\n self._lua_enqueue_script = enqueue_file.read()\n self._lua_enqueue = self._r.register_script(\n self._lua_enqueue_script)\n\n with open(os.path.join(\n lua_script_path,\n 'dequeue.lua'), 'r') as dequeue_file:\n self._lua_dequeue_script = dequeue_file.read()\n self._lua_dequeue = self._r.register_script(\n self._lua_dequeue_script)\n\n with open(os.path.join(\n lua_script_path,\n 'finish.lua'), 'r') as finish_file:\n self._lua_finish_script = finish_file.read()\n self._lua_finish = self._r.register_script(self._lua_finish_script)\n\n with open(os.path.join(\n lua_script_path,\n 'interval.lua'), 'r') as interval_file:\n self._lua_interval_script = interval_file.read()\n self._lua_interval = self._r.register_script(\n self._lua_interval_script)\n\n with open(os.path.join(\n lua_script_path,\n 'requeue.lua'), 'r') as requeue_file:\n self._lua_requeue_script = requeue_file.read()\n self._lua_requeue = self._r.register_script(\n self._lua_requeue_script)\n\n with open(os.path.join(\n lua_script_path,\n 'metrics.lua'), 'r') as metrics_file:\n self._lua_metrics_script = metrics_file.read()\n self._lua_metrics = self._r.register_script(\n self._lua_metrics_script)", "metadata": "root.SharQ._load_lua_scripts", "header": "['class', 'SharQ', '(', 'object', ')', ':', '___EOS___']", "index": 75 }, { "content": " def reload_lua_scripts(self):\n \"\"\"Lets user reload the lua scripts in run time.\"\"\"\n self._load_lua_scripts()", "metadata": "root.SharQ.reload_lua_scripts", "header": "['class', 'SharQ', '(', 'object', ')', ':', '___EOS___']", "index": 123 }, { "content": " def enqueue(self, payload, interval, job_id,\n queue_id, queue_type='default', requeue_limit=None):\n \"\"\"Enqueues the job into the specified queue_id\n of a particular queue_type\n \"\"\"\n # validate all the input\n if not is_valid_interval(interval):\n raise BadArgumentException('`interval` has an invalid value.')\n\n if not is_valid_identifier(job_id):\n raise BadArgumentException('`job_id` has an invalid value.')\n\n if not is_valid_identifier(queue_id):\n raise BadArgumentException('`queue_id` has an invalid value.')\n\n if not is_valid_identifier(queue_type):\n raise BadArgumentException('`queue_type` has an invalid value.')\n\n if requeue_limit is None:\n requeue_limit = self._default_job_requeue_limit\n\n if not is_valid_requeue_limit(requeue_limit):\n raise BadArgumentException('`requeue_limit` has an invalid value.')\n\n try:\n serialized_payload = serialize_payload(payload)\n except TypeError as e:\n raise BadArgumentException(e.message)\n\n timestamp = str(generate_epoch())\n\n keys = [\n self._key_prefix,\n queue_type\n ]\n\n args = [\n timestamp,\n queue_id,\n job_id,\n '\"%s\"' % serialized_payload,\n interval,\n requeue_limit\n ]\n\n self._lua_enqueue(keys=keys, args=args)\n\n response = {\n 'status': 'queued'\n }\n return response", "metadata": "root.SharQ.enqueue", "header": "['class', 'SharQ', '(', 'object', ')', ':', '___EOS___']", "index": 127 }, { "content": " def dequeue(self, queue_type='default'):\n \"\"\"Dequeues a job from any of the ready queues\n based on the queue_type. If no job is ready,\n returns a failure status.\n \"\"\"\n if not is_valid_identifier(queue_type):\n raise BadArgumentException('`queue_type` has an invalid value.')\n\n timestamp = str(generate_epoch())\n\n keys = [\n self._key_prefix,\n queue_type\n ]\n args = [\n timestamp,\n self._job_expire_interval\n ]\n\n dequeue_response = self._lua_dequeue(keys=keys, args=args)\n\n if len(dequeue_response) < 4:\n response = {\n 'status': 'failure'\n }\n return response\n\n queue_id, job_id, payload, requeues_remaining = dequeue_response\n payload = deserialize_payload(payload[1:-1])\n\n response = {\n 'status': 'success',\n 'queue_id': queue_id,\n 'job_id': job_id,\n 'payload': payload,\n 'requeues_remaining': int(requeues_remaining)\n }\n\n return response", "metadata": "root.SharQ.dequeue", "header": "['class', 'SharQ', '(', 'object', ')', ':', '___EOS___']", "index": 179 }, { "content": " def finish(self, job_id, queue_id, queue_type='default'):\n \"\"\"Marks any dequeued job as *completed successfully*.\n Any job which gets a finish will be treated as complete\n and will be removed from the SharQ.\n \"\"\"\n if not is_valid_identifier(job_id):\n raise BadArgumentException('`job_id` has an invalid value.')\n\n if not is_valid_identifier(queue_id):\n raise BadArgumentException('`queue_id` has an invalid value.')\n\n if not is_valid_identifier(queue_type):\n raise BadArgumentException('`queue_type` has an invalid value.')\n\n keys = [\n self._key_prefix,\n queue_type\n ]\n\n args = [\n queue_id,\n job_id\n ]\n\n response = {\n 'status': 'success'\n }\n\n finish_response = self._lua_finish(keys=keys, args=args)\n if finish_response == 0:\n # the finish failed.\n response.update({\n 'status': 'failure'\n })\n\n return response", "metadata": "root.SharQ.finish", "header": "['class', 'SharQ', '(', 'object', ')', ':', '___EOS___']", "index": 219 }, { "content": " def interval(self, interval, queue_id, queue_type='default'):\n \"\"\"Updates the interval for a specific queue_id\n of a particular queue type.\n \"\"\"\n # validate all the input\n if not is_valid_interval(interval):\n raise BadArgumentException('`interval` has an invalid value.')\n\n if not is_valid_identifier(queue_id):\n raise BadArgumentException('`queue_id` has an invalid value.')\n\n if not is_valid_identifier(queue_type):\n raise BadArgumentException('`queue_type` has an invalid value.')\n\n # generate the interval key\n interval_hmap_key = '%s:interval' % self._key_prefix\n interval_queue_key = '%s:%s' % (queue_type, queue_id)\n keys = [\n interval_hmap_key,\n interval_queue_key\n ]\n\n args = [\n interval\n ]\n interval_response = self._lua_interval(keys=keys, args=args)\n if interval_response == 0:\n # the queue with the id and type does not exist.\n response = {\n 'status': 'failure'\n }\n else:\n response = {\n 'status': 'success'\n }\n\n return response", "metadata": "root.SharQ.interval", "header": "['class', 'SharQ', '(', 'object', ')', ':', '___EOS___']", "index": 256 }, { "content": " def requeue(self):\n \"\"\"Re-queues any expired job (one which does not get an expire\n before the job_expiry_interval) back into their respective queue.\n This function has to be run at specified intervals to ensure the\n expired jobs are re-queued back.\n \"\"\"\n timestamp = str(generate_epoch())\n # get all queue_types and requeue one by one.\n # not recommended to do this entire process\n # in lua as it might take long and block other\n # enqueues and dequeues.\n active_queue_type_list = self._r.smembers(\n '%s:active:queue_type' % self._key_prefix)\n for queue_type in active_queue_type_list:\n # requeue all expired jobs in all queue types.\n keys = [\n self._key_prefix,\n queue_type\n ]\n\n args = [\n timestamp\n ]\n job_discard_list = self._lua_requeue(keys=keys, args=args)\n # discard the jobs if any\n for job in job_discard_list:\n queue_id, job_id = job.split(':')\n # explicitly finishing a job\n # is nothing but discard.\n self.finish(\n job_id=job_id,\n queue_id=queue_id,\n queue_type=queue_type\n )", "metadata": "root.SharQ.requeue", "header": "['class', 'SharQ', '(', 'object', ')', ':', '___EOS___']", "index": 294 }, { "content": " def metrics(self, queue_type=None, queue_id=None):\n \"\"\"Provides a way to get statistics about various parameters like,\n * global enqueue / dequeue rates per min.\n * per queue enqueue / dequeue rates per min.\n * queue length of each queue.\n * list of queue ids for each queue type.\n \"\"\"\n if queue_id is not None and not is_valid_identifier(queue_id):\n raise BadArgumentException('`queue_id` has an invalid value.')\n\n if queue_type is not None and not is_valid_identifier(queue_type):\n raise BadArgumentException('`queue_type` has an invalid value.')\n\n response = {\n 'status': 'failure'\n }\n if not queue_type and not queue_id:\n # return global stats.\n # list of active queue types (ready + active)\n active_queue_types = self._r.smembers(\n '%s:active:queue_type' % self._key_prefix)\n ready_queue_types = self._r.smembers(\n '%s:ready:queue_type' % self._key_prefix)\n all_queue_types = active_queue_types | ready_queue_types\n # global rates for past 10 minutes\n timestamp = str(generate_epoch())\n keys = [\n self._key_prefix\n ]\n args = [\n timestamp\n ]\n\n enqueue_details, dequeue_details = self._lua_metrics(\n keys=keys, args=args)\n\n enqueue_counts = {}\n dequeue_counts = {}\n # the length of enqueue & dequeue details are always same.\n for i in xrange(0, len(enqueue_details), 2):\n enqueue_counts[str(enqueue_details[i])] = int(\n enqueue_details[i + 1] or 0)\n dequeue_counts[str(dequeue_details[i])] = int(\n dequeue_details[i + 1] or 0)\n\n response.update({\n 'status': 'success',\n 'queue_types': list(all_queue_types),\n 'enqueue_counts': enqueue_counts,\n 'dequeue_counts': dequeue_counts\n })\n return response\n elif queue_type and not queue_id:\n # return list of queue_ids.\n # get data from two sorted sets in a transaction\n pipe = self._r.pipeline()\n pipe.zrange('%s:%s' % (self._key_prefix, queue_type), 0, -1)\n pipe.zrange('%s:%s:active' % (self._key_prefix, queue_type), 0, -1)\n ready_queues, active_queues = pipe.execute()\n # extract the queue_ids from the queue_id:job_id string\n active_queues = [i.split(':')[0] for i in active_queues]\n all_queue_set = set(ready_queues) | set(active_queues)\n response.update({\n 'status': 'success',\n 'queue_ids': list(all_queue_set)\n })\n return response\n elif queue_type and queue_id:\n # return specific details.\n active_queue_types = self._r.smembers(\n '%s:active:queue_type' % self._key_prefix)\n ready_queue_types = self._r.smembers(\n '%s:ready:queue_type' % self._key_prefix)\n all_queue_types = active_queue_types | ready_queue_types\n # queue specific rates for past 10 minutes\n timestamp = str(generate_epoch())\n keys = [\n '%s:%s:%s' % (self._key_prefix, queue_type, queue_id)\n ]\n args = [\n timestamp\n ]\n\n enqueue_details, dequeue_details = self._lua_metrics(\n keys=keys, args=args)\n\n enqueue_counts = {}\n dequeue_counts = {}\n # the length of enqueue & dequeue details are always same.\n for i in xrange(0, len(enqueue_details), 2):\n enqueue_counts[str(enqueue_details[i])] = int(\n enqueue_details[i + 1] or 0)\n dequeue_counts[str(dequeue_details[i])] = int(\n dequeue_details[i + 1] or 0)\n\n # get the queue length for the job queue\n queue_length = self._r.llen('%s:%s:%s' % (\n self._key_prefix, queue_type, queue_id))\n\n response.update({\n 'status': 'success',\n 'queue_length': int(queue_length),\n 'enqueue_counts': enqueue_counts,\n 'dequeue_counts': dequeue_counts\n })\n return response\n elif not queue_type and queue_id:\n raise BadArgumentException(\n '`queue_id` should be accompanied by `queue_type`.')\n\n return response", "metadata": "root.SharQ.metrics", "header": "['class', 'SharQ', '(', 'object', ')', ':', '___EOS___']", "index": 329 } ]
[ { "span": "import sys", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 10 }, { "span": "import signal", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 13 }, { "span": "from sharq.exceptions import SharqException, BadArgumentException", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 65 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2014", " ", "Pl", "ivo", " ", "Tea", "m", ".", " ", "See", " ", "LICENSE", ".", "txt", " ", "for", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "signal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Config", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "redis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "shar", "q_", "._", "utils_", "import_", "(_", "is", "\\u", "valid", "\\u", "identifier_", ",_", "is", "\\u", "valid", "\\u", "interval_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "valid", "\\u", "reque", "ue", "\\u", "limit_", ",_", "generat", "e\\u", "epoch_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "serialize", "\\u", "payload_", ",_", "deserialize", "\\u", "payload_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "shar", "q_", "._", "exceptions_", "import_", "Shar", "q", "Exception_", ",_", "Ba", "d", "Arg", "ument", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Shar", "Q_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "Shar", "Q", " ", "object", " ", "is", " ", "the", " ", "core", " ", "of", " ", "this", " ", "queue", ".", "\\", "10", ";", " ", " ", " ", " ", "Shar", "Q", " ", "doe", "s", " ", "the", " ", "follow", "ing", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "1", ".", " ", "Accept", "s", " ", "a", " ", "configura", "tion", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "2", ".", " ", "Initializ", "es", " ", "the", " ", "queue", ".", "\\", "10", ";", " ", " ", " ", " ", "3", ".", " ", "Expos", "es", " ", "function", "s", " ", "to", " ", "interact", " ", "with", " ", "the", " ", "queue", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Shar", "Q_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "config", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Construct", " ", "a", " ", "Shar", "Q", " ", "object", " ", "by", " ", "doi", "ng", " ", "the", " ", "follow", "ing", ".", "\\", "10", ";", " ", " ", " ", " ", "1", ".", " ", "Read", " ", "the", " ", "configura", "tion", " ", "path", ".", "\\", "10", ";", " ", " ", " ", " ", "2", ".", " ", "Load", " ", "the", " ", "config", ".", "\\", "10", ";", " ", " ", " ", " ", "3", ".", " ", "Initialized", " ", "Shar", "Q", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "config", "\\u", "path_", "=_", "config", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "load", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "initialize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Shar", "Q_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "initialize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Read", " ", "the", " ", "Shar", "Q", " ", "configura", "tion", " ", "and", " ", "set", " ", "appropr", "iate", "\\", "10", ";", " ", " ", " ", " ", "variab", "les", ".", " ", "Open", " ", "a", " ", "redis", " ", "connecti", "on", " ", "pool", " ", "and", " ", "load", " ", "all", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "Lu", "a", " ", "scripts", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "key", "\\u", "prefix_", "=_", "self_", "._", "\\u", "config_", "._", "get_", "(_", "'", "redis", "'_", ",_", "'", "key", "\\u", "prefix", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "job", "\\u", "expir", "e\\u", "interval_", "=_", "int_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "config_", "._", "get_", "(_", "'", "shar", "q", "'_", ",_", "'", "job", "\\u", "expir", "e\\u", "interval", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "default", "\\u", "job", "\\u", "reque", "ue", "\\u", "limit_", "=_", "int_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "config_", "._", "get_", "(_", "'", "shar", "q", "'_", ",_", "'", "default", "\\u", "job", "\\u", "reque", "ue", "\\u", "limit", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "init", "alize", " ", "redis_", "\\u\\u\\uNL\\u\\u\\u_", "redis", "\\u", "connecti", "on", "\\u", "type_", "=_", "self_", "._", "\\u", "config_", "._", "get_", "(_", "'", "redis", "'_", ",_", "'", "conn", "\\u", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "=_", "self_", "._", "\\u", "config_", "._", "get_", "(_", "'", "redis", "'_", ",_", "'", "db", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "redis", "\\u", "connecti", "on", "\\u", "type_", "==_", "'", "unix", "\\u", "sock", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "r_", "=_", "redis_", "._", "Stri", "ct", "Redis_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "=_", "db_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "unix", "\\u", "socket", "\\u", "path_", "=_", "self_", "._", "\\u", "config_", "._", "get_", "(_", "'", "redis", "'_", ",_", "'", "unix", "\\u", "socket", "\\u", "path", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "redis", "\\u", "connecti", "on", "\\u", "type_", "==_", "'", "tcp", "\\u", "sock", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "r_", "=_", "redis_", "._", "Stri", "ct", "Redis_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "=_", "db_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "host_", "=_", "self_", "._", "\\u", "config_", "._", "get_", "(_", "'", "redis", "'_", ",_", "'", "host", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "self_", "._", "\\u", "config_", "._", "get_", "(_", "'", "redis", "'_", ",_", "'", "port", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "load", "\\u", "lua", "\\u", "scripts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Shar", "Q_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "load", "\\u", "config_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Read", " ", "the", " ", "configura", "tion", " ", "file", " ", "and", " ", "load", " ", "it", " ", "int", "o", " ", "memory", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "config_", "=_", "Config", "Parser_", "._", "Safe", "Config", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "config_", "._", "read_", "(_", "self_", "._", "config", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Shar", "Q_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "relo", "ad", "\\u", "config_", "(_", "self_", ",_", "config", "\\u", "path_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Relo", "ad", " ", "the", " ", "configura", "tion", " ", "from", " ", "the", " ", "new", " ", "config", " ", "file", " ", "if", " ", "provided", "\\", "10", ";", " ", " ", " ", " ", "else", " ", "relo", "ad", " ", "the", " ", "current", " ", "config", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "config", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "config", "\\u", "path_", "=_", "config", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "load", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Shar", "Q_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "load", "\\u", "lua", "\\u", "scripts_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Load", "s", " ", "all", " ", "lua", " ", "scripts", " ", "require", "d", " ", "by", " ", "Shar", "Q", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "load", " ", "lua", " ", "scripts_", "\\u\\u\\uNL\\u\\u\\u_", "lua", "\\u", "script", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "scripts", "/", "lua", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "lua", "\\u", "script", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "enqueue", ".", "lua", "'_", ")_", ",_", "'", "r", "'_", ")_", "as_", "enqueue", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "lua", "\\u", "enqueue", "\\u", "script_", "=_", "enqueue", "\\u", "file_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lua", "\\u", "enqueue_", "=_", "self_", "._", "\\u", "r_", "._", "register", "\\u", "script_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "lua", "\\u", "enqueue", "\\u", "script_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "lua", "\\u", "script", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dequeue", ".", "lua", "'_", ")_", ",_", "'", "r", "'_", ")_", "as_", "dequeue", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "lua", "\\u", "dequeue", "\\u", "script_", "=_", "dequeue", "\\u", "file_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lua", "\\u", "dequeue", "_", "=_", "self_", "._", "\\u", "r_", "._", "register", "\\u", "script_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "lua", "\\u", "dequeue", "\\u", "script_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "lua", "\\u", "script", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "finish", ".", "lua", "'_", ")_", ",_", "'", "r", "'_", ")_", "as_", "finish", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "lua", "\\u", "finish", "\\u", "script_", "=_", "finish", "\\u", "file_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lua", "\\u", "finish_", "=_", "self_", "._", "\\u", "r_", "._", "register", "\\u", "script_", "(_", "self_", "._", "\\u", "lua", "\\u", "finish", "\\u", "script_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "lua", "\\u", "script", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "interval", ".", "lua", "'_", ")_", ",_", "'", "r", "'_", ")_", "as_", "interval", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "lua", "\\u", "interval", "\\u", "script_", "=_", "interval", "\\u", "file_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lua", "\\u", "interval_", "=_", "self_", "._", "\\u", "r_", "._", "register", "\\u", "script_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "lua", "\\u", "interval", "\\u", "script_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "lua", "\\u", "script", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reque", "ue", ".", "lua", "'_", ")_", ",_", "'", "r", "'_", ")_", "as_", "reque", "ue", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "lua", "\\u", "reque", "ue", "\\u", "script_", "=_", "reque", "ue", "\\u", "file_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lua", "\\u", "reque", "ue_", "=_", "self_", "._", "\\u", "r_", "._", "register", "\\u", "script_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "lua", "\\u", "reque", "ue", "\\u", "script_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "lua", "\\u", "script", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "metric", "s", ".", "lua", "'_", ")_", ",_", "'", "r", "'_", ")_", "as_", "metric", "s", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "lua", "\\u", "metric", "s", "\\u", "script_", "=_", "metric", "s", "\\u", "file_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lua", "\\u", "metrics_", "=_", "self_", "._", "\\u", "r_", "._", "register", "\\u", "script_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "lua", "\\u", "metric", "s", "\\u", "script_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Shar", "Q_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "relo", "ad", "\\u", "lua", "\\u", "scripts_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Let", "s", " ", "user", " ", "relo", "ad", " ", "the", " ", "lua", " ", "scripts", " ", "in", " ", "run", " ", "time", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "load", "\\u", "lua", "\\u", "scripts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Shar", "Q_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "enqueue_", "(_", "self_", ",_", "payload_", ",_", "interval_", ",_", "job", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "queue", "\\u", "id_", ",_", "queue", "\\u", "type_", "=_", "'", "default", "'_", ",_", "reque", "ue", "\\u", "limit_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Enque", "ues", " ", "the", " ", "job", " ", "int", "o", " ", "the", " ", "specified", " ", "queue", "\\u", "id", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "a", " ", "partic", "ular", " ", "queue", "\\u", "type", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "validat", "e", " ", "all", " ", "the", " ", "input_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "is", "\\u", "valid", "\\u", "interval_", "(_", "interval_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Arg", "ument", "Exception_", "(_", "'`", "interval", "`", " ", "has", " ", "an", " ", "invalid", " ", "value", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "is", "\\u", "valid", "\\u", "identifier_", "(_", "job", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Arg", "ument", "Exception_", "(_", "'`", "job", "\\u", "id", "`", " ", "has", " ", "an", " ", "invalid", " ", "value", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "is", "\\u", "valid", "\\u", "identifier_", "(_", "queue", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Arg", "ument", "Exception_", "(_", "'`", "queue", "\\u", "id", "`", " ", "has", " ", "an", " ", "invalid", " ", "value", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "is", "\\u", "valid", "\\u", "identifier_", "(_", "queue", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Arg", "ument", "Exception_", "(_", "'`", "queue", "\\u", "type", "`", " ", "has", " ", "an", " ", "invalid", " ", "value", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "reque", "ue", "\\u", "limit_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reque", "ue", "\\u", "limit_", "=_", "self_", "._", "\\u", "default", "\\u", "job", "\\u", "reque", "ue", "\\u", "limit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "is", "\\u", "valid", "\\u", "reque", "ue", "\\u", "limit_", "(_", "reque", "ue", "\\u", "limit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Arg", "ument", "Exception_", "(_", "'`", "reque", "ue", "\\u", "limit", "`", " ", "has", " ", "an", " ", "invalid", " ", "value", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "serialize", "d\\u", "payload_", "=_", "serialize", "\\u", "payload_", "(_", "payload_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Arg", "ument", "Exception_", "(_", "e_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "timestamp_", "=_", "str_", "(_", "generat", "e\\u", "epoch_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "keys_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "key", "\\u", "prefix_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "queue", "\\u", "type_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "timestamp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "queue", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "job", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\"", "%", "s", "\"'_", "%_", "serialize", "d\\u", "payload_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "interval_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reque", "ue", "\\u", "limit_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "lua", "\\u", "enqueue_", "(_", "keys_", "=_", "keys_", ",_", "args_", "=_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "queue", "d", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Shar", "Q_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dequeue", "_", "(_", "self_", ",_", "queue", "\\u", "type_", "=_", "'", "default", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Deq", "ueue", "s", " ", "a", " ", "job", " ", "from", " ", "any", " ", "of", " ", "the", " ", "read", "y", " ", "queue", "s", "\\", "10", ";", " ", " ", " ", " ", "based", " ", "on", " ", "the", " ", "queue", "\\u", "type", ".", " ", "If", " ", "no", " ", "job", " ", "is", " ", "read", "y", ",", "\\", "10", ";", " ", " ", " ", " ", "return", "s", " ", "a", " ", "fail", "ure", " ", "status", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "is", "\\u", "valid", "\\u", "identifier_", "(_", "queue", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Arg", "ument", "Exception_", "(_", "'`", "queue", "\\u", "type", "`", " ", "has", " ", "an", " ", "invalid", " ", "value", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "timestamp_", "=_", "str_", "(_", "generat", "e\\u", "epoch_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "keys_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "key", "\\u", "prefix_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "queue", "\\u", "type_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "timestamp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "job", "\\u", "expir", "e\\u", "interval_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dequeue", "\\u", "response_", "=_", "self_", "._", "\\u", "lua", "\\u", "dequeue", "_", "(_", "keys_", "=_", "keys_", ",_", "args_", "=_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "dequeue", "\\u", "response_", ")_", "<_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "fail", "ure", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "queue", "\\u", "id_", ",_", "job", "\\u", "id_", ",_", "payload_", ",_", "reque", "ues", "\\u", "remaining_", "=_", "dequeue", "\\u", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payload_", "=_", "deserialize", "\\u", "payload_", "(_", "payload_", "[_", "1_", ":_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "success", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "queue", "\\u", "id", "'_", ":_", "queue", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "job", "\\u", "id", "'_", ":_", "job", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "payload", "'_", ":_", "payload_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reque", "ues", "\\u", "rema", "inin", "g", "'_", ":_", "int_", "(_", "reque", "ues", "\\u", "remaining_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Shar", "Q_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "finish_", "(_", "self_", ",_", "job", "\\u", "id_", ",_", "queue", "\\u", "id_", ",_", "queue", "\\u", "type_", "=_", "'", "default", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Mark", "s", " ", "any", " ", "dequeue", "d", " ", "job", " ", "as", " ", "*", "complete", "d", " ", "success", "full", "y", "*.", "\\", "10", ";", " ", " ", " ", " ", "Any", " ", "job", " ", "whi", "ch", " ", "gets", " ", "a", " ", "finish", " ", "will", " ", "be", " ", "treat", "ed", " ", "as", " ", "complete", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "will", " ", "be", " ", "remove", "d", " ", "from", " ", "the", " ", "Shar", "Q", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "is", "\\u", "valid", "\\u", "identifier_", "(_", "job", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Arg", "ument", "Exception_", "(_", "'`", "job", "\\u", "id", "`", " ", "has", " ", "an", " ", "invalid", " ", "value", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "is", "\\u", "valid", "\\u", "identifier_", "(_", "queue", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Arg", "ument", "Exception_", "(_", "'`", "queue", "\\u", "id", "`", " ", "has", " ", "an", " ", "invalid", " ", "value", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "is", "\\u", "valid", "\\u", "identifier_", "(_", "queue", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Arg", "ument", "Exception_", "(_", "'`", "queue", "\\u", "type", "`", " ", "has", " ", "an", " ", "invalid", " ", "value", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "keys_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "key", "\\u", "prefix_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "queue", "\\u", "type_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "queue", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "job", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "success", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "finish", "\\u", "response_", "=_", "self_", "._", "\\u", "lua", "\\u", "finish_", "(_", "keys_", "=_", "keys_", ",_", "args_", "=_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "finish", "\\u", "response_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "finish", " ", "fail", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "fail", "ure", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Shar", "Q_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "interval_", "(_", "self_", ",_", "interval_", ",_", "queue", "\\u", "id_", ",_", "queue", "\\u", "type_", "=_", "'", "default", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Update", "s", " ", "the", " ", "interval", " ", "for", " ", "a", " ", "specific", " ", "queue", "\\u", "id", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "a", " ", "partic", "ular", " ", "queue", " ", "type", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "validat", "e", " ", "all", " ", "the", " ", "input_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "is", "\\u", "valid", "\\u", "interval_", "(_", "interval_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Arg", "ument", "Exception_", "(_", "'`", "interval", "`", " ", "has", " ", "an", " ", "invalid", " ", "value", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "is", "\\u", "valid", "\\u", "identifier_", "(_", "queue", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Arg", "ument", "Exception_", "(_", "'`", "queue", "\\u", "id", "`", " ", "has", " ", "an", " ", "invalid", " ", "value", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "is", "\\u", "valid", "\\u", "identifier_", "(_", "queue", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Arg", "ument", "Exception_", "(_", "'`", "queue", "\\u", "type", "`", " ", "has", " ", "an", " ", "invalid", " ", "value", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "generat", "e", " ", "the", " ", "interval", " ", "key_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "interval", "\\u", "hma", "p", "\\u", "key_", "=_", "'%", "s", ":", "interval", "'_", "%_", "self_", "._", "\\u", "key", "\\u", "prefix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "interval", "\\u", "queue", "\\u", "key_", "=_", "'%", "s", ":", "%", "s", "'_", "%_", "(_", "queue", "\\u", "type_", ",_", "queue", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "interval", "\\u", "hma", "p", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "interval", "\\u", "queue", "\\u", "key_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "interval_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "interval", "\\u", "response_", "=_", "self_", "._", "\\u", "lua", "\\u", "interval_", "(_", "keys_", "=_", "keys_", ",_", "args_", "=_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "interval", "\\u", "response_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "queue", " ", "with", " ", "the", " ", "id", " ", "and", " ", "type", " ", "doe", "s", " ", "not", " ", "exist", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "fail", "ure", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "success", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Shar", "Q_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reque", "ue_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Re", "-", "queue", "s", " ", "any", " ", "expir", "ed", " ", "job", " ", "(", "one", " ", "whi", "ch", " ", "doe", "s", " ", "not", " ", "get", " ", "an", " ", "expir", "e", "\\", "10", ";", " ", " ", " ", " ", "bef", "ore", " ", "the", " ", "job", "\\u", "expir", "y", "\\u", "interval", ")", " ", "back", " ", "int", "o", " ", "thei", "r", " ", "respec", "tiv", "e", " ", "queue", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "has", " ", "to", " ", "be", " ", "run", " ", "at", " ", "specified", " ", "interval", "s", " ", "to", " ", "ensure", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "expir", "ed", " ", "jobs", " ", "are", " ", "re", "-", "queue", "d", " ", "back", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timestamp_", "=_", "str_", "(_", "generat", "e\\u", "epoch_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "all", " ", "queue", "\\u", "types", " ", "and", " ", "reque", "ue", " ", "one", " ", "by", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "recommende", "d", " ", "to", " ", "do", " ", "this", " ", "entire", " ", "process_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "lua", " ", "as", " ", "it", " ", "mig", "ht", " ", "take", " ", "long", " ", "and", " ", "block", " ", "other_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "enqueue", "s", " ", "and", " ", "dequeue", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "active", "\\u", "queue", "\\u", "type", "\\u", "list_", "=_", "self_", "._", "\\u", "r_", "._", "sme", "mber", "s_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", ":", "active", ":", "queue", "\\u", "type", "'_", "%_", "self_", "._", "\\u", "key", "\\u", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "queue", "\\u", "type_", "in_", "active", "\\u", "queue", "\\u", "type", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "reque", "ue", " ", "all", " ", "expir", "ed", " ", "jobs", " ", "in", " ", "all", " ", "queue", " ", "types", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keys_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "key", "\\u", "prefix_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "queue", "\\u", "type_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "timestamp_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "discard", "\\u", "list_", "=_", "self_", "._", "\\u", "lua", "\\u", "reque", "ue_", "(_", "keys_", "=_", "keys_", ",_", "args_", "=_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "discard", " ", "the", " ", "jobs", " ", "if", " ", "any_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "job_", "in_", "job", "\\u", "discard", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "queue", "\\u", "id_", ",_", "job", "\\u", "id_", "=_", "job_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "explicit", "ly", " ", "finish", "ing", " ", "a", " ", "job_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "not", "hing", " ", "but", " ", "discard", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "finish_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "job", "\\u", "id_", "=_", "job", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "queue", "\\u", "id_", "=_", "queue", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "queue", "\\u", "type_", "=_", "queue", "\\u", "type_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Shar", "Q_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "metrics_", "(_", "self_", ",_", "queue", "\\u", "type_", "=_", "None_", ",_", "queue", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Prov", "ides", " ", "a", " ", "way", " ", "to", " ", "get", " ", "statistic", "s", " ", "abo", "ut", " ", "vari", "ous", " ", "parameter", "s", " ", "like", ",", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "global", " ", "enqueue", " ", "/", " ", "dequeue", " ", "rate", "s", " ", "per", " ", "min", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "per", " ", "queue", " ", "enqueue", " ", "/", " ", "dequeue", " ", "rate", "s", " ", "per", " ", "min", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "queue", " ", "length", " ", "of", " ", "each", " ", "queue", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "list", " ", "of", " ", "queue", " ", "ids", " ", "for", " ", "each", " ", "queue", " ", "type", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "queue", "\\u", "id_", "is_", "not_", "None_", "and_", "not_", "is", "\\u", "valid", "\\u", "identifier_", "(_", "queue", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Arg", "ument", "Exception_", "(_", "'`", "queue", "\\u", "id", "`", " ", "has", " ", "an", " ", "invalid", " ", "value", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "queue", "\\u", "type_", "is_", "not_", "None_", "and_", "not_", "is", "\\u", "valid", "\\u", "identifier_", "(_", "queue", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Arg", "ument", "Exception_", "(_", "'`", "queue", "\\u", "type", "`", " ", "has", " ", "an", " ", "invalid", " ", "value", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "fail", "ure", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "queue", "\\u", "type_", "and_", "not_", "queue", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "return", " ", "global", " ", "stats", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "list", " ", "of", " ", "active", " ", "queue", " ", "types", " ", "(", "read", "y", " ", "+", " ", "active", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "active", "\\u", "queue", "\\u", "types_", "=_", "self_", "._", "\\u", "r_", "._", "sme", "mber", "s_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", ":", "active", ":", "queue", "\\u", "type", "'_", "%_", "self_", "._", "\\u", "key", "\\u", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "y", "\\u", "queue", "\\u", "types_", "=_", "self_", "._", "\\u", "r_", "._", "sme", "mber", "s_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", ":", "read", "y", ":", "queue", "\\u", "type", "'_", "%_", "self_", "._", "\\u", "key", "\\u", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "queue", "\\u", "types_", "=_", "active", "\\u", "queue", "\\u", "types_", "|_", "read", "y", "\\u", "queue", "\\u", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "global", " ", "rate", "s", " ", "for", " ", "past", " ", "10", " ", "minutes_", "\\u\\u\\uNL\\u\\u\\u_", "timestamp_", "=_", "str_", "(_", "generat", "e\\u", "epoch_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "key", "\\u", "prefix_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "timestamp_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "enqueue", "\\u", "details_", ",_", "dequeue", "\\u", "details_", "=_", "self_", "._", "\\u", "lua", "\\u", "metrics_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "keys_", "=_", "keys_", ",_", "args_", "=_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "enqueue", "\\u", "counts_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dequeue", "\\u", "counts_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "length", " ", "of", " ", "enqueue", " ", "&", " ", "dequeue", " ", "deta", "il", "s", " ", "are", " ", "alw", "ay", "s", " ", "same", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "0_", ",_", "len_", "(_", "enqueue", "\\u", "details_", ")_", ",_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "enqueue", "\\u", "counts_", "[_", "str_", "(_", "enqueue", "\\u", "details_", "[_", "i_", "]_", ")_", "]_", "=_", "int_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "enqueue", "\\u", "details_", "[_", "i_", "+_", "1_", "]_", "or_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dequeue", "\\u", "counts_", "[_", "str_", "(_", "dequeue", "\\u", "details_", "[_", "i_", "]_", ")_", "]_", "=_", "int_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "dequeue", "\\u", "details_", "[_", "i_", "+_", "1_", "]_", "or_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "success", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "queue", "\\u", "types", "'_", ":_", "list_", "(_", "all", "\\u", "queue", "\\u", "types_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "enqueue", "\\u", "count", "s", "'_", ":_", "enqueue", "\\u", "counts_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dequeue", "\\u", "count", "s", "'_", ":_", "dequeue", "\\u", "counts_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "queue", "\\u", "type_", "and_", "not_", "queue", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "return", " ", "list", " ", "of", " ", "queue", "\\u", "ids", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "data", " ", "from", " ", "two", " ", "sorte", "d", " ", "sets", " ", "in", " ", "a", " ", "transaction_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pipe_", "=_", "self_", "._", "\\u", "r_", "._", "pipeline_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pipe_", "._", "zr", "ange_", "(_", "'%", "s", ":", "%", "s", "'_", "%_", "(_", "self_", "._", "\\u", "key", "\\u", "prefix_", ",_", "queue", "\\u", "type_", ")_", ",_", "0_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pipe_", "._", "zr", "ange_", "(_", "'%", "s", ":", "%", "s", ":", "active", "'_", "%_", "(_", "self_", "._", "\\u", "key", "\\u", "prefix_", ",_", "queue", "\\u", "type_", ")_", ",_", "0_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "y", "\\u", "queues_", ",_", "active", "\\u", "queues_", "=_", "pipe_", "._", "execute_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "extract", " ", "the", " ", "queue", "\\u", "ids", " ", "from", " ", "the", " ", "queue", "\\u", "id", ":", "job", "\\u", "id", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "active", "\\u", "queues_", "=_", "[_", "i_", "._", "split_", "(_", "':'_", ")_", "[_", "0_", "]_", "for_", "i_", "in_", "active", "\\u", "queues_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "queue", "\\u", "set_", "=_", "set_", "(_", "read", "y", "\\u", "queues_", ")_", "|_", "set_", "(_", "active", "\\u", "queues_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "success", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "queue", "\\u", "ids", "'_", ":_", "list_", "(_", "all", "\\u", "queue", "\\u", "set_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "queue", "\\u", "type_", "and_", "queue", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "return", " ", "specific", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "active", "\\u", "queue", "\\u", "types_", "=_", "self_", "._", "\\u", "r_", "._", "sme", "mber", "s_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", ":", "active", ":", "queue", "\\u", "type", "'_", "%_", "self_", "._", "\\u", "key", "\\u", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "y", "\\u", "queue", "\\u", "types_", "=_", "self_", "._", "\\u", "r_", "._", "sme", "mber", "s_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", ":", "read", "y", ":", "queue", "\\u", "type", "'_", "%_", "self_", "._", "\\u", "key", "\\u", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "queue", "\\u", "types_", "=_", "active", "\\u", "queue", "\\u", "types_", "|_", "read", "y", "\\u", "queue", "\\u", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "queue", " ", "specific", " ", "rate", "s", " ", "for", " ", "past", " ", "10", " ", "minutes_", "\\u\\u\\uNL\\u\\u\\u_", "timestamp_", "=_", "str_", "(_", "generat", "e\\u", "epoch_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", ":", "%", "s", ":", "%", "s", "'_", "%_", "(_", "self_", "._", "\\u", "key", "\\u", "prefix_", ",_", "queue", "\\u", "type_", ",_", "queue", "\\u", "id_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "timestamp_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "enqueue", "\\u", "details_", ",_", "dequeue", "\\u", "details_", "=_", "self_", "._", "\\u", "lua", "\\u", "metrics_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "keys_", "=_", "keys_", ",_", "args_", "=_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "enqueue", "\\u", "counts_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dequeue", "\\u", "counts_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "length", " ", "of", " ", "enqueue", " ", "&", " ", "dequeue", " ", "deta", "il", "s", " ", "are", " ", "alw", "ay", "s", " ", "same", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "0_", ",_", "len_", "(_", "enqueue", "\\u", "details_", ")_", ",_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "enqueue", "\\u", "counts_", "[_", "str_", "(_", "enqueue", "\\u", "details_", "[_", "i_", "]_", ")_", "]_", "=_", "int_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "enqueue", "\\u", "details_", "[_", "i_", "+_", "1_", "]_", "or_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dequeue", "\\u", "counts_", "[_", "str_", "(_", "dequeue", "\\u", "details_", "[_", "i_", "]_", ")_", "]_", "=_", "int_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "dequeue", "\\u", "details_", "[_", "i_", "+_", "1_", "]_", "or_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "queue", " ", "length", " ", "for", " ", "the", " ", "job", " ", "queue_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "queue", "\\u", "length_", "=_", "self_", "._", "\\u", "r_", "._", "llen", "_", "(_", "'%", "s", ":", "%", "s", ":", "%", "s", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "key", "\\u", "prefix_", ",_", "queue", "\\u", "type_", ",_", "queue", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "success", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "queue", "\\u", "length", "'_", ":_", "int_", "(_", "queue", "\\u", "length_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "enqueue", "\\u", "count", "s", "'_", ":_", "enqueue", "\\u", "counts_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dequeue", "\\u", "count", "s", "'_", ":_", "dequeue", "\\u", "counts_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "queue", "\\u", "type_", "and_", "queue", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Arg", "ument", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'`", "queue", "\\u", "id", "`", " ", "shou", "ld", " ", "be", " ", "accom", "pani", "ed", " ", "by", " ", "`", "queue", "\\u", "type", "`.", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "response_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
sympy/sympy/sympy/core/tests/test_truediv.py
[ { "content": "def test_basic():\n def s(a, b):\n x = a\n x = +a\n x = -a\n x = a + b\n x = a - b\n x = a*b\n x = a/b\n x = a**b\n assert dotest(s)", "metadata": "root.test_basic", "header": "['module', '___EOS___']", "index": 30 } ]
[ { "span": "x ", "start_line": 39, "start_column": 8, "end_line": 39, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "basic_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "s_", "(_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "+_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "-_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "a_", "+_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "a_", "-_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "a_", "*_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "a_", "/_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "a_", "**_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "dot", "est_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]